X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportalapp%2Fportal%2Fservice%2FExternalAccessRolesService.java;h=ee960c4079d869e2e2713ff9aae45066d31bd38e;hb=a70761c096192e38800bf38d6c7f61f52bf72007;hp=d65f115230c0cb7eb109ac16046ca75d7e02abb9;hpb=21a8761f684745bb300e075c7e98ad897ace9eed;p=portal.git diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java index d65f1152..ee960c40 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java @@ -33,13 +33,14 @@ * * ============LICENSE_END============================================ * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * */ package org.onap.portalapp.portal.service; import java.io.IOException; import java.util.List; import java.util.Map; +import java.util.Set; import org.hibernate.Session; import org.json.JSONArray; @@ -49,13 +50,18 @@ import org.onap.portalapp.portal.domain.EPApp; import org.onap.portalapp.portal.domain.EPRole; import org.onap.portalapp.portal.domain.EPUser; import org.onap.portalapp.portal.domain.ExternalRoleDetails; +import org.onap.portalapp.portal.ecomp.model.UploadRoleFunctionExtSystem; +import org.onap.portalapp.portal.exceptions.InvalidUserException; +import org.onap.portalapp.portal.exceptions.RoleFunctionException; import org.onap.portalapp.portal.transport.CentralRole; +import org.onap.portalapp.portal.transport.CentralRoleFunction; import org.onap.portalapp.portal.transport.CentralUser; import org.onap.portalapp.portal.transport.CentralV2Role; import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; import org.onap.portalsdk.core.domain.Role; -import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.restful.domain.EcompRole; import org.onap.portalsdk.core.restful.domain.EcompUser; +import org.springframework.http.HttpEntity; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpClientErrorException; @@ -100,7 +106,7 @@ public interface ExternalAccessRolesService { * @return EPUser object * @throws Exception */ - List getUser(String loginId) throws Exception; + List getUser(String loginId) throws InvalidUserException; /** * It returns complete user information including application roles permissions @@ -131,11 +137,11 @@ public interface ExternalAccessRolesService { CentralV2Role getRoleInfo(Long roleId, String uebkey) throws Exception; /** - * It returns the CentralRoleFunction object + * It returns the CentralV2RoleFunction object * * @param functionCode * @param uebkey - * @return CentralRoleFunction + * @return CentralV2RoleFunction * @throws Exception */ public CentralV2RoleFunction getRoleFunction(String functionCode, String uebkey) throws Exception; @@ -149,7 +155,7 @@ public interface ExternalAccessRolesService { * @throws Exception */ public boolean saveCentralRoleFunction(CentralV2RoleFunction domainCentralRoleFunction, EPApp requestedApp) throws Exception; - + /** * It deletes role function in the DB * @@ -238,7 +244,7 @@ public interface ExternalAccessRolesService { * @param upload * @throws Exception */ - public void bulkUploadPartnerFunctions(String uebkey, List upload) throws Exception; + public Integer bulkUploadPartnerFunctions(String uebkey) throws Exception; /** * It uploads partner application role functions into external auth system @@ -258,7 +264,7 @@ public interface ExternalAccessRolesService { Integer bulkUploadRolesFunctions(String uebkey) throws Exception; /** - * It syncs the roles and rolefunctions to the ecomp DB from AAF + * It syncs the roles and rolefunctions to the ONAP DB from AAF * @param app * @throws Exception */ @@ -280,7 +286,7 @@ public interface ExternalAccessRolesService { * @param roleList * @throws Exception */ - void bulkUploadPartnerRoleFunctions(String uebkey, List roleList) throws Exception; + Integer bulkUploadPartnerRoleFunctions(String uebkey) throws Exception; /** * it deletes all dependency role records @@ -334,11 +340,11 @@ public interface ExternalAccessRolesService { public List getGlobalRolesOfPortal(); /** - * It converts list of CentralRoleFunction objects to RoleFunction objects + * It converts list of CentralV2RoleFunction objects to older version of CentralRoleFunction objects * @param answer contains list of CentralRoleFunction objects - * @return List of RoleFunction objects + * @return List of CentralRoleFunction objects */ - public List convertCentralRoleFunctionToRoleFunctionObject(List answer); + public List convertCentralRoleFunctionToRoleFunctionObject(List answer); /** * @@ -384,7 +390,7 @@ public interface ExternalAccessRolesService { * @param app * @return List of EPRole objects */ - Map getCurrentRolesInDB(EPApp app); + Map getAppRoleNamesWithUnderscoreMap(EPApp app); /** @@ -432,5 +438,82 @@ public interface ExternalAccessRolesService { ObjectMapper mapper, JSONArray extRole) throws IOException, JsonParseException, JsonMappingException; public JSONArray getAllUsersByRole(String roleName) throws Exception; + + /** + * + * It check function code has any pipes, if found return function type + * + * @param roleFuncItem + * @param type + * @return function type + */ + String getFunctionCodeType(String roleFuncItem); + + /** + * It return function action + * + * @param roleFuncItem + * @return String action + */ + String getFunctionCodeAction(String roleFuncItem); + + /** + * + * Adds function to role in external auth system + * + * @param data + * @param app + */ + void bulkUploadRoleFunc(UploadRoleFunctionExtSystem data, EPApp app) throws Exception; + + /** + * + * Syncs user roles from external auth system to ecomp portal + * + * @param orgUserId + * @throws Exception + */ + public void syncApplicationUserRolesFromExtAuthSystem(String orgUserId) throws Exception; + + /** + * + * Gets all user roles from external auth system + * + * @param orgUserId + * @param getUserRolesEntity + * @return user roles from external auth system + */ + ResponseEntity getUserRolesFromExtAuthSystem(String orgUserId, HttpEntity getUserRolesEntity) throws Exception; + + /** + * + * Updates app role description in external auth system + * + * @param uebkey + * @return number of updates + */ + public Integer updateAppRoleDescription(String uebkey); + + /** + * Creates centralRoleObject + * @param app + * @param roleInfo + * @param roleList + * @param params + * @return returns List + * @throws RoleFunctionException + */ + public List createCentralRoleObject(List app, List roleInfo, + List roleList, Map params) throws RoleFunctionException; + + /** + * + * @param uebkey + * @param loginId + * @param CurrentUserRoles + * @return returns list of user roles + * @throws Exception + */ + public List missingUserApplicationRoles(String uebkey, String loginId, Set CurrentUserRoles) throws Exception; }