|
|
@@ -11,10 +11,12 @@ import org.keycloak.representations.idm.RoleRepresentation;
|
|
|
import org.keycloak.representations.idm.UserRepresentation;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
|
@DubboService
|
|
|
@@ -126,4 +128,18 @@ public class KeycloakServiceImpl implements KeycloakService {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<String> getAiAuditList() {
|
|
|
+ List<GroupRepresentation> groups = keycloak.realm(realm).groups().groups();
|
|
|
+ List<String> aiAudit = groups.stream().filter(groupRepresentation -> {
|
|
|
+ Map<String, List<String>> attributes = groupRepresentation.getAttributes();
|
|
|
+ if (attributes != null) {
|
|
|
+ List<String> list = attributes.get("aiAudit");
|
|
|
+ return !CollectionUtils.isEmpty(list) && "1".equals(list.get(0));
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).map(GroupRepresentation::getPath).collect(Collectors.toList());
|
|
|
+ return aiAudit;
|
|
|
+ }
|
|
|
+
|
|
|
}
|