feat: move competition setting to ffsaf site

This commit is contained in:
2024-08-09 12:09:37 +02:00
parent b766525000
commit 27dd22080c
43 changed files with 1616 additions and 34 deletions

View File

@@ -32,7 +32,7 @@ public class CompteEndpoints {
KeycloakService service;
@Inject
JsonWebToken accessToken;
JsonWebToken idToken;
@Inject
SecurityIdentity securityIdentity;
@@ -53,8 +53,9 @@ public class CompteEndpoints {
})
public Uni<KeycloakService.UserCompteState> getCompte(@PathParam("id") String id) {
return service.fetchCompte(id).call(pair -> vertx.getOrCreateContext().executeBlocking(() -> {
if (!securityIdentity.getRoles().contains("federation_admin") && pair.getKey().groups().stream().map(GroupRepresentation::getPath)
.noneMatch(s -> s.startsWith("/club/") && GroupeUtils.contains(s, accessToken)))
if (!securityIdentity.getRoles().contains("federation_admin") && pair.getKey().groups().stream()
.map(GroupRepresentation::getPath)
.noneMatch(s -> s.startsWith("/club/") && GroupeUtils.contains(s, idToken)))
throw new DForbiddenException();
return pair;
})).map(Pair::getValue);