Skip to content

Commit

Permalink
feat: add deletable flag to admin-ui role object #888 (#901)
Browse files Browse the repository at this point in the history
  • Loading branch information
duttarnab authored Feb 24, 2022
1 parent 370ac91 commit 5b95a55
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private AdminRole getRoleObjByName(String role) throws ApplicationException {
log.error(ErrorResponse.ROLE_NOT_FOUND.getDescription());
throw new ApplicationException(Response.Status.BAD_REQUEST.getStatusCode(), ErrorResponse.ROLE_NOT_FOUND.getDescription());
}
return roles.get(0);
return roles.stream().findFirst().get();
} catch (ApplicationException e) {
log.error(ErrorResponse.GET_ADMIUI_ROLES_ERROR.getDescription());
throw e;
Expand Down Expand Up @@ -310,7 +310,7 @@ public List<RolePermissionMapping> mapPermissionsToRole(RolePermissionMapping ro
public List<RolePermissionMapping> removePermissionsFromRole(RolePermissionMapping rolePermissionMappingArg) throws ApplicationException {
try {
AdminConf adminConf = entryManager.find(AdminConf.class, CONFIG_DN);
if (isFalse(getRoleObjByName(role).getDeletable())) {
if (isFalse(getRoleObjByName(rolePermissionMappingArg.getRole()).getDeletable())) {
log.error(ErrorResponse.ROLE_MARKED_UNDELETABLE.getDescription());
throw new ApplicationException(Response.Status.BAD_REQUEST.getStatusCode(), ErrorResponse.ROLE_MARKED_UNDELETABLE.getDescription());
}
Expand Down

0 comments on commit 5b95a55

Please sign in to comment.