CADI AAF Integration and merging the code
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / service / UserRolesService.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * 
37  */
38
39 package org.onap.portalapp.portal.service;
40
41 import java.util.List;
42
43 import org.apache.cxf.transport.http.HTTPException;
44 import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser;
45 import org.onap.portalapp.portal.domain.EPRole;
46 import org.onap.portalapp.portal.domain.EPUser;
47 import org.onap.portalapp.portal.domain.EPUserApp;
48 import org.onap.portalapp.portal.domain.EPUserAppCatalogRoles;
49 import org.onap.portalapp.portal.domain.ExternalSystemAccess;
50 import org.onap.portalapp.portal.transport.AppWithRolesForUser;
51 import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator;
52 import org.onap.portalapp.portal.transport.FieldsValidator;
53 import org.onap.portalapp.portal.transport.RoleInAppForUser;
54 import org.onap.portalapp.portal.transport.UserApplicationRoles;
55
56 public interface UserRolesService {
57
58         /**
59          * Returns list of app roles of a single app
60          * 
61          * @param appId
62          *            ID of row in fn_app
63          * @param userId
64          *            ID of row in fn_user
65          * @param extRequestValue
66          *            set to false if request is from users page otherwise true
67          * @param  
68          * @return List<RoleInAppForUser>
69          */
70         public List<RoleInAppForUser> getAppRolesForUser(Long appId, String userId, Boolean extRequestValue, EPUser user );
71
72         public ExternalRequestFieldsValidator setAppWithUserRoleStateForUser(EPUser user, AppWithRolesForUser newAppRolesForUser);
73
74         public List<UserApplicationRoles> getUsersFromAppEndpoint(Long appId) throws HTTPException;
75
76         public List<EPRole> importRolesFromRemoteApplication(Long appId) throws HTTPException;
77
78         /**
79          * Gets entries from the local fn_user_role table for the specified user and
80          * app.
81          * 
82          * @param appId
83          *            ID of row in fn_app
84          * @param userId
85          *            ID of row in fn_user
86          * @return List of EPRole; empty if none found.
87          */
88         public List<EPUserApp> getCachedAppRolesForUser(Long appId, Long userId);
89
90         public FieldsValidator putUserAppRolesRequest(AppWithRolesForUser userAppRolesData, EPUser user);
91
92         /**
93          * Save user app roles in the database from the external request
94          * 
95          * @param newAppRolesForUser
96          * 
97          *            contains login id, app name, request id, and list of role
98          *            names
99          * @param reqType
100          * @return if any exceptions, returns detail message and true or false
101          */
102         ExternalRequestFieldsValidator setExternalRequestUserAppRole(ExternalSystemUser newAppRolesForUser, String reqType);
103
104         public List<EPUserAppCatalogRoles> getUserAppCatalogRoles(EPUser user, String appName);
105
106         public String updateRemoteUserProfile(String orgUserId, Long appId);
107
108         public ExternalSystemAccess getExternalRequestAccess();
109         
110         public List<EPUserApp> getEPUserAppList(Long appId, Long userId, Long roleId);
111
112 }