diff options
Diffstat (limited to 'POLICY-SDK-APP/src')
-rw-r--r-- | POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java index 44a133068..a42d3d8d7 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java @@ -114,6 +114,13 @@ public class AutoPushController extends RestrictedBaseController { return policyController != null ? getPolicyController() : new PolicyController(); } + private Set<String> addAllScopes(Roles userRole, Set<String> scopes) { + if (userRole.getScope() != null) { + scopes.addAll(Stream.of(userRole.getScope().split(",")).collect(Collectors.toSet())); + } + return scopes; + } + @RequestMapping(value = {"/get_AutoPushPoliciesContainerData"}, method = {RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) public void getPolicyGroupContainerData(HttpServletRequest request, HttpServletResponse response) { @@ -130,8 +137,9 @@ public class AutoPushController extends RestrictedBaseController { for (Object role : userRoles) { Roles userRole = (Roles) role; roles.add(userRole.getRole()); - scopes.addAll(Stream.of(userRole.getScope().split(",")).collect(Collectors.toSet())); + addAllScopes(userRole, scopes); } + if (roles.contains("super-admin") || roles.contains("super-editor") || roles.contains("super-guest")) { data = commonClassDao.getData(PolicyVersion.class); } else { |