From 4588cfbed461c8a86a6218d672399697711b9443 Mon Sep 17 00:00:00 2001 From: kamidu Date: Tue, 10 Jan 2017 17:22:42 +0530 Subject: [PATCH] Fixing the permission management issue in EMM console --- .../mgt/jaxrs/service/impl/RoleManagementServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/RoleManagementServiceImpl.java index ee664e2c63..dd6932981f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/RoleManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/RoleManagementServiceImpl.java @@ -404,10 +404,15 @@ public class RoleManagementServiceImpl implements RoleManagementService { // Get all role permissions final UIPermissionNode rolePermissions = this.getAllRolePermissions(roleName, userRealm); List permissions = new ArrayList(); + final UIPermissionNode emmRolePermissions = (UIPermissionNode)this.getRolePermissions(roleName); + List emmConsolePermissions = new ArrayList(); + this.getAuthorizedPermissions(emmRolePermissions, emmConsolePermissions); + emmConsolePermissions.removeAll(new ArrayList(Arrays.asList(roleInfo.getPermissions()))); this.getAuthorizedPermissions(rolePermissions, permissions); for (String permission : roleInfo.getPermissions()) { permissions.add(permission); } + permissions.removeAll(emmConsolePermissions); String [] allApplicablePerms = new String[permissions.size()]; allApplicablePerms = permissions.toArray(allApplicablePerms); roleInfo.setPermissions(allApplicablePerms);