Skip to content

Commit

Permalink
Set DevSettings adminRoles
Browse files Browse the repository at this point in the history
  • Loading branch information
cgendreau committed Feb 14, 2025
1 parent 350d269 commit 27376eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Map<String, Set<DinaRole>> getRolesPerGroup() {
return groupDinaRole;
}

private Set<DinaRole> getAdminRoles() {
public Set<DinaRole> getAdminRoles() {
if (adminRole == null || adminRole.isEmpty()) {
return Set.of();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Set;
import lombok.Getter;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -64,6 +65,10 @@ public DinaAuthenticatedUser currentUser() {
authenticatedUserBuilder.rolesPerGroup(Map.of("dev-group", Set.of(DinaRole.USER)));
}

if (CollectionUtils.isNotEmpty(devSettings.getAdminRoles())) {
authenticatedUserBuilder.adminRoles(devSettings.getAdminRoles());
}

return authenticatedUserBuilder.build();
}

Expand Down

0 comments on commit 27376eb

Please sign in to comment.