summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-os/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-BE-os/src/main')
-rw-r--r--ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java
index 76a9b40f..28f1e67f 100644
--- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java
+++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java
@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.openecomp.portalapp.controller.EPRestrictedBaseController;
+import org.openecomp.portalapp.portal.domain.EPRole;
import org.openecomp.portalapp.portal.domain.EPUser;
import org.openecomp.portalapp.portal.logging.aop.EPAuditLog;
import org.openecomp.portalapp.portal.service.AdminRolesService;
@@ -114,4 +115,23 @@ public class PortalAdminController extends EPRestrictedBaseController {
return fieldsValidator;
}
+
+ @RequestMapping(value = { "/portalApi/adminAppsRoles/{appId}" }, method = RequestMethod.GET, produces = "application/json")
+ public List<EPRole> getRolesByApp(HttpServletRequest request, @PathVariable("appId") Long appId,
+ HttpServletResponse response) {
+ EPUser user = EPUserUtils.getUserSession(request);
+ List<EPRole> rolesByApp = null;
+
+ try {
+ if (user == null) {
+ EcompPortalUtils.setBadPermissions(user, response, "getUserApps");
+ } else {
+ rolesByApp = adminRolesService.getRolesByApp(user, appId);
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getRolesByApp failed", e);
+ }
+
+ return rolesByApp;
+ }
}