Skip to content

Commit

Permalink
Bugfix for super_users who are also manager
Browse files Browse the repository at this point in the history
Before this commit super_users with also the
manager_role could not change the applications
for a role, due to the constraint that this is
not allowed for managers.
  • Loading branch information
oharsta committed Nov 18, 2024
1 parent 1bb7a88 commit 0729bea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/src/main/java/access/api/RoleController.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ private ResponseEntity<Role> saveOrUpdate(Role role, User user) {
boolean isNew = role.getId() == null;
List<String> previousApplicationIdentifiers = new ArrayList<>();
Optional<UserRole> optionalUserRole = user.userRoleForRole(role);
boolean immutableApplicationUsages = optionalUserRole.isPresent() && optionalUserRole.get().getAuthority().equals(Authority.MANAGER);
boolean immutableApplicationUsages = !user.isSuperUser() &&
optionalUserRole.isPresent() && optionalUserRole.get().getAuthority().equals(Authority.MANAGER);
boolean nameChanged = false;
if (!isNew) {
Role previousRole = roleRepository.findById(role.getId()).orElseThrow(() -> new NotFoundException("Role not found"));
Expand Down

0 comments on commit 0729bea

Please sign in to comment.