Onboarding Page Account Admin Change
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / controller / RoleManageController.java
index b50d1cf..ad16472 100644 (file)
@@ -517,13 +517,14 @@ public class RoleManageController extends EPRestrictedBaseController {
                                return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Data is not valid", "ERROR");
                        }
                }
+
                EPUser user = EPUserUtils.getUserSession(request);
                boolean saveOrUpdateResponse = false;
                try {
                        EPApp requestedApp = appService.getApp(appId);
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
-                               if (requestedApp.getCentralAuth()) {
+                               if (requestedApp.getCentralAuth() && roleFunc!=null) {
                                        String code = roleFunc.getType() + PIPE + roleFunc.getCode() + PIPE + roleFunc.getAction();
                                        CentralV2RoleFunction domainRoleFunction = externalAccessRolesService.getRoleFunction(code,
                                                        requestedApp.getUebKey());
@@ -679,7 +680,7 @@ public class RoleManageController extends EPRestrictedBaseController {
        }
 
        @RequestMapping(value = { "/portalApi/centralizedApps" }, method = RequestMethod.GET)
-       public List<CentralizedApp> getCentralizedAppRoles(HttpServletRequest request, HttpServletResponse response, String userId) throws IOException {
+       public List<CentralizedApp> getCentralizedAppRoles(HttpServletRequest request, HttpServletResponse response, String userId) {
                if(userId!=null) {
                        SecureString secureString = new SecureString(userId);
 
@@ -691,6 +692,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                                return null;
                        }
                }
+
                EPUser user = EPUserUtils.getUserSession(request);
                List<CentralizedApp> applicationsList = null;
                if (adminRolesService.isAccountAdmin(user) || adminRolesService.isSuperAdmin(user)
@@ -817,7 +819,7 @@ public class RoleManageController extends EPRestrictedBaseController {
 
        private boolean isAuthorizedUser(EPUser user, EPApp requestedApp) {
                if (user != null && (adminRolesService.isAccountAdminOfApplication(user, requestedApp)
-                               || (adminRolesService.isSuperAdmin(user) && requestedApp.getId() == PortalConstants.PORTAL_APP_ID)))
+                               || (adminRolesService.isSuperAdmin(user) && requestedApp.getId().equals(PortalConstants.PORTAL_APP_ID))))
                        return true;
                return false;
        }