summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesService.java
blob: 643e22851a70132b134ff46e46fcd54bf4535112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
/*-
 * ============LICENSE_START==========================================
 * ONAP Portal
 * ===================================================================
 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 * ===================================================================
 *
 * Unless otherwise specified, all software contained herein is licensed
 * under the Apache License, Version 2.0 (the “License”);
 * you may not use this software except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *             http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Unless otherwise specified, all documentation contained herein is licensed
 * under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
 * you may not use this documentation except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *             https://creativecommons.org/licenses/by/4.0/
 *
 * Unless required by applicable law or agreed to in writing, documentation
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * ============LICENSE_END============================================
 *
 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
 */
package org.openecomp.portalapp.portal.service;

import java.util.List;

import org.hibernate.Session;
import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
import org.openecomp.portalapp.portal.domain.EPApp;
import org.openecomp.portalapp.portal.domain.EPRole;
import org.openecomp.portalapp.portal.domain.EPUser;
import org.openecomp.portalapp.portal.transport.CentralRole;
import org.openecomp.portalsdk.core.domain.Role;
import org.openecomp.portalsdk.core.domain.RoleFunction;
import org.openecomp.portalsdk.core.restful.domain.EcompUser;

public interface ExternalAccessRolesService {
	
	/**
	 * It gets list of application roles 
	 * 
	 * @param appId
	 * @return List
	 * @throws Exception 
	 */
	public List<EPRole> getAppRoles(Long appId) throws Exception;
	
	/**
	 * It returns single app record
	 * 
	 * @param uebkey
	 * @return List
	 * @throws Exception 
	 */		
	public List<EPApp> getApp(String uebkey) throws Exception;
	
	/**
	 * Adds role in the external access system if fails throws exception
	 * 
	 * @param addRoles
	 * @param uebkey
	 * @return boolean
	 * @throws Exception
	 */
	public boolean addRole(Role addRoles, String uebkey) throws Exception;

	/**
	 * It returns complete user information
	 * 
	 * @param loginId
	 * @return EPUser object
	 * @throws Exception
	 */
	List<EPUser> getUser(String loginId) throws Exception;
	
	/**
	 * It returns complete user information including application roles permissions
	 * 
	 * @param loginId
	 * @param uebkey
	 * @return String
	 * @throws Exception
	 */
	String getUserWithRoles(String loginId, String uebkey) throws Exception;

	/**
	 * It returns list of all role functions
	 * @param string 
	 * @return List
	 * @throws Exception 
	 */
	List<CentralRoleFunction> getRoleFuncList(String string) throws Exception;
	
	/**
	 * It return list of role provided by the app uebkey and roleId
	 * 
	 * @param roleId
	 * @param uebkey
	 * @return CentralRole
	 * @throws Exception
	 */
	CentralRole getRoleInfo(Long roleId, String uebkey) throws Exception;
	
	/**
	 *  It returns the CentralRoleFunction object 
	 *   
	 * @param functionCode
	 * @param uebkey 
	 * @return CentralRoleFunction
	 * @throws Exception 
	 */
	public CentralRoleFunction getRoleFunction(String functionCode, String uebkey) throws Exception;

	/**
	 *  It saves role function in the DB
	 *  
	 * @param domainCentralRoleFunction
	 * @param requestedApp 
	 * @return true else false
	 * @throws Exception 
	 */
	public boolean saveCentralRoleFunction(CentralRoleFunction domainCentralRoleFunction, EPApp requestedApp) throws Exception;

	/**
	 * It deletes role function in the DB
	 * 
	 * @param code
	 * @param app 
	 */
	public boolean deleteCentralRoleFunction(String code, EPApp app);

	/**
	 * It gets all roles the applications
	 * 
	 * @param uebkey
	 * @return List
	 * @throws Exception 
	 */
	public List<CentralRole> getRolesForApp(String uebkey) throws Exception;
	
	/**
	 * It saves role function in the DB
	 * 
	 * @param saveRole
	 * @param uebkey
	 * @throws Exception 
	 */
	boolean saveRoleForApplication(Role saveRole, String uebkey) throws Exception;

	/**
	 *  It deletes role in the DB
	 *  
	 * @param code
	 * @param uebkey
	 * @return true else false
	 * @throws Exception 
	 */
	boolean deleteRoleForApplication(String code, String uebkey) throws Exception;

	/**
	 * It gets all active roles for single application 
	 * 
	 * @param uebkey
	 * @return List
	 * @throws Exception
	 */
	List<CentralRole> getActiveRoles(String uebkey) throws Exception;
	
	/**
	 * It deletes user related roles for an application in the table
	 * @param roleId
	 * @param uebkey
	 * @param LoginId 
	 * @return true else false
	 * @throws Exception 
	 */
	public boolean deleteDependencyRoleRecord(Long roleId, String uebkey, String LoginId) throws Exception;
	
	/**
	 * It sync new functions codes and names from and updates role functions from external access system
	 * 
	 * @param app
	 * @throws Exception
	 */
	public void syncRoleFunctionFromExternalAccessSystem(EPApp app) throws Exception;

	/**
	 * It uploads portal functions into external auth system
	 * @param uebkey
	 * @return
	 * @throws Exception
	 */
	public Integer bulkUploadFunctions(String uebkey) throws Exception;

	/**
	 * It uploads portal roles into external auth system
	 * @param uebkey
	 * @return
	 * @throws Exception
	 */
	public Integer bulkUploadRoles(String uebkey) throws Exception;

	/**
	 * It uploads partner application role functions into external auth system
	 * 
	 * @param uebkey
	 * @param upload
	 * @throws Exception
	 */
	public void bulkUploadPartnerFunctions(String uebkey, List<RoleFunction> upload) throws Exception;

	/** 
	 * It uploads partner application role functions into external auth system
	 * 
	 * @param uebkey
	 * @param upload
	 * @throws Exception
	 */
	public void bulkUploadPartnerRoles(String uebkey, List<Role> upload) throws Exception;

	/**
	 * It returns total no. of portal application role functions records added in external auth system 
	 * @param uebkey
	 * @return
	 * @throws Exception
	 */
	Integer bulkUploadRolesFunctions(String uebkey) throws Exception;
	
	/**
	 *  It syncs the roles and rolefunctions to the ecomp DB from AAF
	 * @param app
	 * @throws Exception
	 */
	void syncApplicationRolesWithEcompDB(EPApp app) throws Exception;

	/**
	 * It uploads list of user roles of the application into external auth system 
	 * 
	 * @param uebkey
	 * @return
	 * @throws Exception
	 */
	public Integer bulkUploadUserRoles(String uebkey) throws Exception;

	/**
	 * It Uploads partner application role functions into external auth system
	 * 
	 * @param uebkey
	 * @param roleList
	 * @throws Exception
	 */
	void bulkUploadPartnerRoleFunctions(String uebkey, List<Role> roleList) throws Exception;

	/**
	 * it deletes all dependency role records 
	 * 
	 * @param localSession
	 * @param roleId
	 * @param appId
	 * @throws Exception
	 */
	public void deleteRoleDependencyRecords(Session localSession, Long roleId, Long appId) throws Exception;

	/**
	 * It returns list of applications functions along with functions associated with global role
	 * 
	 * @param uebkey
	 * @return
	 * @throws Exception
	 */
	List<String> getMenuFunctionsList(String uebkey) throws Exception;
	
	/**
	 * 
	 * @param uebkey applications UebKey
	 * @return
	 * @throws Exception
	 * Method getAllUsers returns all the active users of application
	 */
	List<EcompUser> getAllAppUsers(String uebkey) throws Exception;

}