当前位置: 首页>>代码示例>>Java>>正文


Java GroupDescription.Basic方法代码示例

本文整理汇总了Java中com.google.gerrit.common.data.GroupDescription.Basic方法的典型用法代码示例。如果您正苦于以下问题:Java GroupDescription.Basic方法的具体用法?Java GroupDescription.Basic怎么用?Java GroupDescription.Basic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gerrit.common.data.GroupDescription的用法示例。


在下文中一共展示了GroupDescription.Basic方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildGroupInfo

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
private Map<AccountGroup.UUID, GroupInfo> buildGroupInfo(List<AccessSection> local) {
  Map<AccountGroup.UUID, GroupInfo> infos = new HashMap<>();
  for (AccessSection section : local) {
    for (Permission permission : section.getPermissions()) {
      for (PermissionRule rule : permission.getRules()) {
        if (rule.getGroup() != null) {
          AccountGroup.UUID uuid = rule.getGroup().getUUID();
          if (uuid != null && !infos.containsKey(uuid)) {
            GroupDescription.Basic group = groupBackend.get(uuid);
            infos.put(uuid, group != null ? new GroupInfo(group) : null);
          }
        }
      }
    }
  }
  return Maps.filterEntries(infos, in -> in.getValue() != null);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:ProjectAccessFactory.java

示例2: parse

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
@Override
public GroupResource parse(TopLevelResource parent, IdString id)
    throws AuthException, ResourceNotFoundException {
  final CurrentUser user = self.get();
  if (user instanceof AnonymousUser) {
    throw new AuthException("Authentication required");
  } else if (!(user.isIdentifiedUser())) {
    throw new ResourceNotFoundException(id);
  }

  GroupDescription.Basic group = parseId(id.get());
  if (group == null) {
    throw new ResourceNotFoundException(id.get());
  }
  GroupControl ctl = groupControlFactory.controlFor(group);
  if (!ctl.isVisible()) {
    throw new ResourceNotFoundException(id);
  }
  return new GroupResource(ctl);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:GroupsCollection.java

示例3: updateGroupNames

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
/**
 * Check all GroupReferences use current group name, repairing stale ones.
 *
 * @param groupBackend cache to use when looking up group information by UUID.
 * @return true if one or more group names was stale.
 */
public boolean updateGroupNames(GroupBackend groupBackend) {
  boolean dirty = false;
  for (GroupReference ref : groupList.references()) {
    GroupDescription.Basic g = groupBackend.get(ref.getUUID());
    if (g != null && !g.getName().equals(ref.getName())) {
      dirty = true;
      ref.setName(g.getName());
    }
  }
  return dirty;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:ProjectConfig.java

示例4: deliverToMembers

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
private void deliverToMembers(Watchers.List matching, AccountGroup.UUID startUUID) {
  Set<AccountGroup.UUID> seen = new HashSet<>();
  List<AccountGroup.UUID> q = new ArrayList<>();

  seen.add(startUUID);
  q.add(startUUID);

  while (!q.isEmpty()) {
    AccountGroup.UUID uuid = q.remove(q.size() - 1);
    GroupDescription.Basic group = args.groupBackend.get(uuid);
    if (group == null) {
      continue;
    }
    if (!Strings.isNullOrEmpty(group.getEmailAddress())) {
      // If the group has an email address, do not expand membership.
      matching.emails.add(new Address(group.getEmailAddress()));
      continue;
    }

    if (!(group instanceof GroupDescription.Internal)) {
      // Non-internal groups cannot be expanded by the server.
      continue;
    }

    GroupDescription.Internal ig = (GroupDescription.Internal) group;
    matching.accounts.addAll(ig.getMembers());
    for (AccountGroup.UUID m : ig.getSubgroups()) {
      if (seen.add(m)) {
        q.add(m);
      }
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:34,代码来源:ProjectWatch.java

示例5: controlFor

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
public GroupControl controlFor(CurrentUser who, AccountGroup.UUID groupId)
    throws NoSuchGroupException {
  GroupDescription.Basic group = groupBackend.get(groupId);
  if (group == null) {
    throw new NoSuchGroupException(groupId);
  }
  return new GroupControl(who, group, permissionBackend, groupBackend);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:GroupControl.java

示例6: createGroupInfo

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
private GroupInfo createGroupInfo(
    GroupDescription.Basic group, Supplier<GroupControl> groupControlSupplier)
    throws OrmException {
  GroupInfo info = createBasicGroupInfo(group);

  if (group instanceof GroupDescription.Internal) {
    addInternalDetails(info, (GroupDescription.Internal) group, groupControlSupplier);
  }

  return info;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:12,代码来源:GroupJson.java

示例7: createBasicGroupInfo

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
private static GroupInfo createBasicGroupInfo(GroupDescription.Basic group) {
  GroupInfo info = new GroupInfo();
  info.id = Url.encode(group.getGroupUUID().get());
  info.name = Strings.emptyToNull(group.getName());
  info.url = Strings.emptyToNull(group.getUrl());
  info.options = createOptions(group);
  return info;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:GroupJson.java

示例8: addInternalDetails

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void addInternalDetails(
    GroupInfo info,
    GroupDescription.Internal internalGroup,
    Supplier<GroupControl> groupControlSupplier)
    throws OrmException {
  info.description = Strings.emptyToNull(internalGroup.getDescription());
  info.groupId = internalGroup.getId().get();

  AccountGroup.UUID ownerGroupUUID = internalGroup.getOwnerGroupUUID();
  if (ownerGroupUUID != null) {
    info.ownerId = Url.encode(ownerGroupUUID.get());
    GroupDescription.Basic o = groupBackend.get(ownerGroupUUID);
    if (o != null) {
      info.owner = o.getName();
    }
  }

  info.createdOn = internalGroup.getCreatedOn();

  if (options.contains(MEMBERS)) {
    info.members = listMembers.get().getDirectMembers(internalGroup, groupControlSupplier.get());
  }

  if (options.contains(INCLUDES)) {
    info.includes =
        listSubgroups.get().getDirectSubgroups(internalGroup, groupControlSupplier.get());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:30,代码来源:GroupJson.java

示例9: GroupControl

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
GroupControl(
    CurrentUser who,
    GroupDescription.Basic gd,
    PermissionBackend permissionBackend,
    GroupBackend gb) {
  user = who;
  group = gd;
  this.perm = permissionBackend.user(user);
  groupBackend = gb;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:GroupControl.java

示例10: asInternalGroup

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
public Optional<GroupDescription.Internal> asInternalGroup() {
  GroupDescription.Basic group = getGroup();
  if (group instanceof GroupDescription.Internal) {
    return Optional.of((GroupDescription.Internal) group);
  }
  return Optional.empty();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:GroupResource.java

示例11: get

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
@Override
public GroupDescription.Basic get(AccountGroup.UUID uuid) {
  final GroupReference ref = uuids.get(uuid);
  if (ref == null) {
    return null;
  }
  return new GroupDescription.Basic() {
    @Override
    public String getName() {
      return ref.getName();
    }

    @Override
    public AccountGroup.UUID getGroupUUID() {
      return ref.getUUID();
    }

    @Override
    public String getUrl() {
      return null;
    }

    @Override
    public String getEmailAddress() {
      return null;
    }
  };
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:29,代码来源:SystemGroupBackend.java

示例12: getAccessSections

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
List<AccessSection> getAccessSections(Map<String, AccessSectionInfo> sectionInfos)
    throws UnprocessableEntityException {
  if (sectionInfos == null) {
    return Collections.emptyList();
  }

  List<AccessSection> sections = new ArrayList<>(sectionInfos.size());
  for (Map.Entry<String, AccessSectionInfo> entry : sectionInfos.entrySet()) {
    if (entry.getValue().permissions == null) {
      continue;
    }

    AccessSection accessSection = new AccessSection(entry.getKey());
    for (Map.Entry<String, PermissionInfo> permissionEntry :
        entry.getValue().permissions.entrySet()) {
      if (permissionEntry.getValue().rules == null) {
        continue;
      }

      Permission p = new Permission(permissionEntry.getKey());
      if (permissionEntry.getValue().exclusive != null) {
        p.setExclusiveGroup(permissionEntry.getValue().exclusive);
      }

      for (Map.Entry<String, PermissionRuleInfo> permissionRuleInfoEntry :
          permissionEntry.getValue().rules.entrySet()) {
        GroupDescription.Basic group = groupsCollection.parseId(permissionRuleInfoEntry.getKey());
        if (group == null) {
          throw new UnprocessableEntityException(
              permissionRuleInfoEntry.getKey() + " is not a valid group ID");
        }

        PermissionRuleInfo pri = permissionRuleInfoEntry.getValue();
        PermissionRule r = new PermissionRule(GroupReference.forGroup(group));
        if (pri != null) {
          if (pri.max != null) {
            r.setMax(pri.max);
          }
          if (pri.min != null) {
            r.setMin(pri.min);
          }
          r.setAction(GetAccess.ACTION_TYPE.inverse().get(pri.action));
          if (pri.force != null) {
            r.setForce(pri.force);
          }
        }
        p.add(r);
      }
      accessSection.getPermissions().add(p);
    }
    sections.add(accessSection);
  }
  return sections;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:55,代码来源:SetAccessUtil.java

示例13: get

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
@Override
public GroupDescription.Basic get(AccountGroup.UUID uuid) {
  if (!handles(uuid)) {
    return null;
  }

  String groupDn = uuid.get().substring(LDAP_UUID.length());
  CurrentUser user = userProvider.get();
  if (!(user.isIdentifiedUser()) || !membershipsOf(user.asIdentifiedUser()).contains(uuid)) {
    try {
      if (!existsCache.get(groupDn)) {
        return null;
      }
    } catch (ExecutionException e) {
      log.warn(String.format("Cannot lookup group %s in LDAP", groupDn), e);
      return null;
    }
  }

  final String name = LDAP_NAME + cnFor(groupDn);
  return new GroupDescription.Basic() {
    @Override
    public AccountGroup.UUID getGroupUUID() {
      return uuid;
    }

    @Override
    public String getName() {
      return name;
    }

    @Override
    @Nullable
    public String getEmailAddress() {
      return null;
    }

    @Override
    @Nullable
    public String getUrl() {
      return null;
    }
  };
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:45,代码来源:LdapGroupBackend.java

示例14: getMemberDescription

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
public GroupDescription.Basic getMemberDescription() {
  return member;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:4,代码来源:SubgroupResource.java

示例15: getMyGroup

import com.google.gerrit.common.data.GroupDescription; //导入方法依赖的package包/类
private GroupReference getMyGroup() {
  GroupDescription.Basic g = groupBackend.get(AccountGroup.UUID.parse("user:" + username));
  return projectConfig.resolve(GroupReference.forGroup(g));
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:5,代码来源:CreateProjectStep.java


注:本文中的com.google.gerrit.common.data.GroupDescription.Basic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。