feat: add membre
This commit is contained in:
@@ -121,7 +121,7 @@ public class KeycloakService {
|
||||
return vertx.getOrCreateContext().executeBlocking(() -> {
|
||||
UserResource user = keycloak.realm(realm).users().get(id);
|
||||
UserRepresentation user2 = user.toRepresentation();
|
||||
return new Pair<>(user, new UserCompteState(user2.isEnabled(), user2.getUsername(), user2.isEmailVerified())) ;
|
||||
return new Pair<>(user, new UserCompteState(user2.isEnabled(), user2.getUsername(), user2.isEmailVerified()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -195,6 +195,17 @@ public class KeycloakService {
|
||||
return membreService.setUserId(id, nid).map(__ -> "OK");
|
||||
}
|
||||
|
||||
public Uni<?> removeAccount(String userId) {
|
||||
return vertx.getOrCreateContext().executeBlocking(() -> {
|
||||
try (Response response = keycloak.realm(realm).users().delete(userId)) {
|
||||
System.out.println(response.getStatusInfo());
|
||||
if (!response.getStatusInfo().equals(Response.Status.NO_CONTENT))
|
||||
throw new KeycloakException("Fail to delete user %s (reason=%s)".formatted(userId, response.getStatusInfo().getReasonPhrase()));
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private Optional<UserRepresentation> getUser(String username) {
|
||||
List<UserRepresentation> users = keycloak.realm(realm).users().searchByUsername(username, true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user