UserRealm realm = registry.getUserRealm();
String adminRole = realm.getRealmConfiguration().getAdminRoleName();
AuthorizationManager authMan = realm.getAuthorizationManager();
if (!authMan.isRoleAuthorized(adminRole, CarbonConstants.UI_PERMISSION_COLLECTION,
UserMgtConstants.EXECUTE_ACTION)) {
authMan.authorizeRole(adminRole, CarbonConstants.UI_PERMISSION_COLLECTION,
UserMgtConstants.EXECUTE_ACTION);
}
} catch (Exception e) {
log.error("While adding management permission :: " + e.getMessage(), e);
throw new Exception("While adding management permission :: " + e.getMessage(), e);