Skip to content

Commit

Permalink
[ALS-4793] Remove duplicate default role
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcolon021 committed Aug 18, 2023
1 parent 4fce73e commit a8ae11c
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ public Response authenticate(Map<String, String> authRequest) {
if (current_user == null) {
current_user = userRepository.createOpenAccessUser();

// All roles already exist, so we don't need to create them.
// We are using this approach so it is added to the user's roles
setDefaultUserRoles(current_user);

//clear some cache entries if we register a new login
AuthorizationService.clearCache(current_user);
UserService.clearCache(current_user);

setDefaultUserRoles(current_user);
}

HashMap<String, Object> claims = new HashMap<>();
Expand All @@ -63,7 +61,6 @@ public Response authenticate(Map<String, String> authRequest) {
}

private void setDefaultUserRoles(User current_user) {
fenceAuthenticationService.upsertRole(current_user, FENCEAuthenticationService.fence_open_access_role_name, null);
fenceAuthenticationService.upsertRole(current_user, "FENCE_PRIV_OPEN_ACCESS", null);
fenceAuthenticationService.upsertRole(current_user, "FENCE_PRIV_DICTIONARY", null);
userRepository.merge(current_user);
Expand Down

0 comments on commit a8ae11c

Please sign in to comment.