Skip to content

Commit

Permalink
fix: explicit modification of roles (#258)
Browse files Browse the repository at this point in the history
fix: implement explicit setting of roles
  • Loading branch information
paullatzelsperger authored Feb 5, 2024
1 parent 53b8249 commit c800847
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ public void deleteParticipant(@PathParam("participantId") String participantId,
@Path("/{participantId}/roles")
@RolesAllowed(ServicePrincipal.ROLE_ADMIN)
public void updateRoles(@PathParam("participantId") String participantId, List<String> roles) {
participantContextService.updateParticipant(participantId, participantContext -> {
participantContext.getRoles().clear();
participantContext.getRoles().addAll(roles);
}).orElseThrow(exceptionMapper(ParticipantContext.class, participantId));
participantContextService.updateParticipant(participantId, participantContext -> participantContext.setRoles(roles)).orElseThrow(exceptionMapper(ParticipantContext.class, participantId));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

Expand Down Expand Up @@ -100,7 +101,11 @@ public String getDid() {
}

public List<String> getRoles() {
return roles;
return Collections.unmodifiableList(roles);
}

public void setRoles(List<String> roles) {
this.roles = roles;
}

@JsonPOJOBuilder(withPrefix = "")
Expand Down

0 comments on commit c800847

Please sign in to comment.