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 ee664e2c63d..dd6932981f8 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);