org.keycloak.models.RealmModel.getTopLevelGroups()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(69)

本文整理了Java中org.keycloak.models.RealmModel.getTopLevelGroups方法的一些代码示例,展示了RealmModel.getTopLevelGroups的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RealmModel.getTopLevelGroups方法的具体详情如下:
包路径:org.keycloak.models.RealmModel
类名称:RealmModel
方法名:getTopLevelGroups

RealmModel.getTopLevelGroups介绍

暂无

代码示例

代码示例来源:origin: org.keycloak/keycloak-model-api

public static List<GroupRepresentation> toGroupHierarchy(RealmModel realm, boolean full) {
  List<GroupRepresentation> hierarchy = new LinkedList<>();
  List<GroupModel> groups = realm.getTopLevelGroups();
  if (groups == null) return hierarchy;
  for (GroupModel group : groups) {
    GroupRepresentation rep = toGroupHierarchy(group, full);
    hierarchy.add(rep);
  }
  return hierarchy;
}

代码示例来源:origin: org.keycloak/keycloak-model-api

public static GroupModel findGroupByPath(RealmModel realm, String path) {
  if (path == null) {
    return null;
  }
  if (path.startsWith("/")) {
    path = path.substring(1);
  }
  if (path.endsWith("/")) {
    path = path.substring(0, path.length() - 1);
  }
  String[] split = path.split("/");
  if (split.length == 0) return null;
  GroupModel found = null;
  for (GroupModel group : realm.getTopLevelGroups()) {
    if (group.getName().equals(split[0])) {
      if (split.length == 1) {
        found = group;
        break;
      }
      else {
        if (split.length > 1) {
          found = findSubGroup(split, 1, group);
          if (found != null) break;
        }
      }
    }
  }
  return found;
}

代码示例来源:origin: org.keycloak/keycloak-authz-policy-common

List<GroupModel> topLevelGroups = authorization.getRealm().getTopLevelGroups();

相关文章

微信公众号

最新文章

更多

RealmModel类方法