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


Java GroupPrincipal类代码示例

本文整理汇总了Java中com.google.enterprise.adaptor.GroupPrincipal的典型用法代码示例。如果您正苦于以下问题:Java GroupPrincipal类的具体用法?Java GroupPrincipal怎么用?Java GroupPrincipal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getDocIds

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
/** Crawls/pushes all groups from all AdServers. */

  @Override
  public void getDocIds(DocIdPusher pusher) throws InterruptedException,
      IOException {
    log.log(Level.FINER, "getDocIds invoked - waiting for lock.");
    mutex.lock();
    try {
      clearLastCompleteGroupCatalog();
      GroupCatalog cumulativeCatalog = makeFullCatalog();
      // all servers were able to successfully populate the catalog: do a push
      // TODO(myk): Rework the structure so that a member variable of
      // cumulativeCatalog isn't passed in as a parameter to its own method.
      cumulativeCatalog.resolveForeignSecurityPrincipals(
          cumulativeCatalog.entities);
      Map<GroupPrincipal, List<Principal>> groups =
          cumulativeCatalog.makeDefs(cumulativeCatalog.entities);
      pusher.pushGroupDefinitions(groups, EVERYTHING_CASE_INSENSITIVE, REPLACE,
          null, null);
      // no longer clear cumulativeCatalog.members as part of fix for b/18028678
      lastCompleteGroupCatalog = cumulativeCatalog;
    } finally {
      mutex.unlock();
      log.log(Level.FINE, "getDocIds ending - lock released.");
    }
  }
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:27,代码来源:AdAdaptor.java

示例2: testGroupCatalogMakeDefsWithDisabledGroup

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testGroupCatalogMakeDefsWithDisabledGroup() throws Exception {
  AdAdaptor.GroupCatalog groupCatalog = new GroupCatalogBuilder().build();

  MockLdapContext ldapContext = mockLdapContextForMakeDefs(true);

  AdServer adServer = new AdServer("localhost", "" /*userSearchBaseDN*/,
      "" /*groupSearchBaseDN*/, "" /*userSearchFilter*/,
      "" /*groupSearchFilter*/, ldapContext);
  adServer.initialize();

  groupCatalog.readEverythingFrom(adServer, /*includeMembers=*/ true);

  tweakGroupCatalogForMakeDefs(groupCatalog, adServer, true);

  final Map<GroupPrincipal, List<Principal>> golden =
      new HashMap<GroupPrincipal, List<Principal>>();
  {
    golden.put(new GroupPrincipal("[email protected]", "example.com"),
        Collections.<Principal>emptyList());
    golden.put(new GroupPrincipal("known_group", "example.com"),
        Collections.<Principal>emptyList());
  }
  assertEquals(golden, groupCatalog.makeDefs(groupCatalog.entities));
}
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:26,代码来源:AdAdaptorTest.java

示例3: testFakeAdaptorUserAndPasswordSpecified

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testFakeAdaptorUserAndPasswordSpecified() throws Exception {
  AdAdaptor adAdaptor = new FakeAdaptor();
  RecordingDocIdPusher pusher = new RecordingDocIdPusher();
  Map<String, String> configEntries = new HashMap<String, String>();
  configEntries.put("gsa.hostname", "localhost");
  configEntries.put("ad.servers", "server1");
  configEntries.put("ad.servers.server1.host", "localhost");
  configEntries.put("ad.servers.server1.port", "1234");
  configEntries.put("ad.servers.server1.user", "username");
  configEntries.put("ad.servers.server1.password", "password");
  configEntries.put("ad.servers.server1.method", "ssl");
  configEntries.put("ad.userSearchBaseDN", "ou=DoesNotMatter");
  configEntries.put("server.port", "5680");
  configEntries.put("server.dashboardPort", "5681");
  pushGroupDefinitions(adAdaptor, configEntries, pusher, /*fullPush=*/ true,
      /*init=*/ true);
  Map<GroupPrincipal, Collection<Principal>> results =
      pusher.getGroupDefinitions();
  // the above (eventually) calls AdAdaptor.init() with the specified config.
}
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:22,代码来源:AdAdaptorTest.java

示例4: testFakeAdaptorDefaultUserAndPasswordSpecified

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testFakeAdaptorDefaultUserAndPasswordSpecified()
    throws Exception {
  AdAdaptor adAdaptor = new FakeAdaptor();
  RecordingDocIdPusher pusher = new RecordingDocIdPusher();
  Map<String, String> configEntries = new HashMap<String, String>();
  configEntries.put("gsa.hostname", "localhost");
  configEntries.put("ad.servers", "server1");
  configEntries.put("ad.servers.server1.host", "localhost");
  configEntries.put("ad.servers.server1.port", "1234");
  configEntries.put("ad.servers.server1.method", "ssl");
  configEntries.put("ad.defaultUser", "defaultUser");
  configEntries.put("ad.defaultPassword", "defaultPassword");
  configEntries.put("ad.groupSearchBaseDN", "ou=DoesNotMatter");
  configEntries.put("server.port", "5680");
  configEntries.put("server.dashboardPort", "5681");
  pushGroupDefinitions(adAdaptor, configEntries, pusher, /*fullPush=*/ true,
      /*init=*/ true);
  Map<GroupPrincipal, Collection<Principal>> results =
      pusher.getGroupDefinitions();
  // the above (eventually) calls AdAdaptor.init() with the specified config.
}
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:23,代码来源:AdAdaptorTest.java

示例5: listMembers

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
private void listMembers(MemberService memberService, long id,
    Set<UserPrincipal> users, Set<GroupPrincipal> groups)
    throws SOAPFaultException {
  List<Member> members = memberService.listMembers(id);
  for (Member member : members) {
    if (!isActive(member)) {
      log.log(Level.FINEST, "Is not active: " + member.getName());
      continue;
    }
    if ("User".equals(member.getType())) {
      users.add(getUserPrincipal(member));
    } else if ("Group".equals(member.getType())) {
      groups.add(getGroupPrincipal(member));
    } else if ("ProjectGroup".equals(member.getType())) {
      // ProjectGroups can be references to parent
      // ProjectGroups when, for example, a Project is nested
      // within another Project.
      listMembers(memberService, member.getID(), users, groups);
    }
  }
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:22,代码来源:OpentextAdaptor.java

示例6: testGetDocIdsMarkPublicFalse

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testGetDocIdsMarkPublicFalse() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("adaptor.markAllDocsAsPublic", "false");
  adaptor.init(context);

  soapFactory.memberServiceMock.addMember(
      getMember(1000, "user1", "User"));
  soapFactory.memberServiceMock.addMember(
      getMember(2000, "group1", "Group"));
  soapFactory.memberServiceMock.addMemberToGroup(
      2000, soapFactory.memberServiceMock.getMemberById(1000));

  RecordingDocIdPusher pusher = new RecordingDocIdPusher();
  adaptor.getDocIds(pusher);
  Map<GroupPrincipal, List<Principal>> expected =
      new HashMap<GroupPrincipal, List<Principal>>();
  expected.put(newGroupPrincipal("group1"),
      Lists.<Principal>newArrayList(newUserPrincipal("user1")));
  assertEquals(expected, pusher.getGroupDefinitions());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:25,代码来源:OpentextAdaptorTest.java

示例7: testGetGroupsDeletedUser

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testGetGroupsDeletedUser() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  Member active = getMember(1, "user1", "User");
  Member deleted = getMember(2, "user2", "User");
  deleted.setDeleted(true);
  Member group = getMember(11, "group1", "Group");
  soapFactory.memberServiceMock.addMember(active);
  soapFactory.memberServiceMock.addMember(deleted);
  soapFactory.memberServiceMock.addMember(group);
  soapFactory.memberServiceMock.addMemberToGroup(group.getID(), active);
  soapFactory.memberServiceMock.addMemberToGroup(group.getID(), deleted);

  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  adaptor.init(context);
  OpentextAdaptor.Groups groups =
      adaptor.new Groups(soapFactory.newMemberService());
  groups.addGroups();
  Map<GroupPrincipal, List<Principal>> groupDefinitions =
      groups.getGroupDefinitions();
  assertEquals(Lists.newArrayList(newUserPrincipal("user1")),
      groupDefinitions.get(newGroupPrincipal("group1")));
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:26,代码来源:OpentextAdaptorTest.java

示例8: testGetGroupsDeletedGroup

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testGetGroupsDeletedGroup() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  Member active = getMember(1, "user1", "User");
  Member group = getMember(11, "group1", "Group");
  group.setDeleted(true);
  soapFactory.memberServiceMock.addMember(active);
  soapFactory.memberServiceMock.addMember(group);
  soapFactory.memberServiceMock.addMemberToGroup(group.getID(), active);

  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  adaptor.init(context);
  OpentextAdaptor.Groups groups =
      adaptor.new Groups(soapFactory.newMemberService());
  groups.addGroups();
  Map<GroupPrincipal, List<Principal>> groupDefinitions =
      groups.getGroupDefinitions();
  assertEquals(null, groupDefinitions.get(newGroupPrincipal("group1")));
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:22,代码来源:OpentextAdaptorTest.java

示例9: testGetGroupsDeletedMemberGroup

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testGetGroupsDeletedMemberGroup() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  Member active = getMember(1, "user1", "User");
  Member memberGroup = getMember(2, "memberGroup", "Group");
  memberGroup.setDeleted(true);
  Member group = getMember(11, "group1", "Group");
  soapFactory.memberServiceMock.addMember(active);
  soapFactory.memberServiceMock.addMember(memberGroup);
  soapFactory.memberServiceMock.addMember(group);
  soapFactory.memberServiceMock.addMemberToGroup(group.getID(), active);
  soapFactory.memberServiceMock.addMemberToGroup(group.getID(), memberGroup);

  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  adaptor.init(context);
  OpentextAdaptor.Groups groups =
      adaptor.new Groups(soapFactory.newMemberService());
  groups.addGroups();
  Map<GroupPrincipal, List<Principal>> groupDefinitions =
      groups.getGroupDefinitions();
  assertEquals(Lists.newArrayList(newUserPrincipal("user1")),
      groupDefinitions.get(newGroupPrincipal("group1")));
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:26,代码来源:OpentextAdaptorTest.java

示例10: testGetGroupsLoginDisabledUser

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testGetGroupsLoginDisabledUser() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  Member active = getMember(1, "user1", "User");
  User disabled = (User) getMember(2, "user2", "User");
  MemberPrivileges memberPrivileges = disabled.getPrivileges();
  memberPrivileges.setLoginEnabled(false);
  Member group = getMember(11, "group1", "Group");
  soapFactory.memberServiceMock.addMember(active);
  soapFactory.memberServiceMock.addMember(disabled);
  soapFactory.memberServiceMock.addMember(group);
  soapFactory.memberServiceMock.addMemberToGroup(group.getID(), active);
  soapFactory.memberServiceMock.addMemberToGroup(group.getID(), disabled);

  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  adaptor.init(context);
  OpentextAdaptor.Groups groups =
      adaptor.new Groups(soapFactory.newMemberService());
  groups.addGroups();
  Map<GroupPrincipal, List<Principal>> groupDefinitions =
      groups.getGroupDefinitions();
  assertEquals(Lists.newArrayList(newUserPrincipal("user1")),
      groupDefinitions.get(newGroupPrincipal("group1")));
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:27,代码来源:OpentextAdaptorTest.java

示例11: testGetGroupPrincipal

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testGetGroupPrincipal() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  Member testMember = new Member();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  adaptor.init(context);

  // unqualified name
  testMember.setName("group1");
  assertEquals(new GroupPrincipal("group1", LOCAL_NAMESPACE),
      adaptor.getGroupPrincipal(testMember));

  // qualified name
  testMember.setName("windowsDomain\\group1");
  assertEquals(
      new GroupPrincipal("windowsDomain\\group1", GLOBAL_NAMESPACE),
      adaptor.getGroupPrincipal(testMember));
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:21,代码来源:OpentextAdaptorTest.java

示例12: getDocIdsSiteCollectionOnly

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
private void getDocIdsSiteCollectionOnly(DocIdPusher pusher)
    throws InterruptedException,IOException {
  log.entering("SharePointAdaptor", "getDocIdsSiteCollectionOnly", pusher);
  SiteAdaptor scAdaptor = getSiteAdaptor(sharePointUrl.getSharePointUrl(), 
      sharePointUrl.getSharePointUrl());
  SiteDataClient scClient = scAdaptor.getSiteDataClient();
  Site site = scClient.getContentSite();
  String siteCollectionUrl = getCanonicalUrl(site.getMetadata().getURL());
  // Reset site collection URL instance to use correct URL.
  scAdaptor = getSiteAdaptor(siteCollectionUrl, siteCollectionUrl);
  DocId siteCollectionDocId = scAdaptor.encodeDocId(siteCollectionUrl);
  pusher.pushDocIds(Arrays.asList(siteCollectionDocId));
  Map<GroupPrincipal, Collection<Principal>> groupDefs 
      = new HashMap<GroupPrincipal, Collection<Principal>>();
  groupDefs.putAll(scAdaptor.computeMembersForGroups(site.getGroups()));
  String siteId = site.getMetadata().getID();
  sitePushGroupDefinitions(siteId, pusher, groupDefs);
  log.exiting("SharePointAdaptor", "getDocIdsSiteCollectionOnly");
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:20,代码来源:SharePointAdaptor.java

示例13: testGetGroupUpdatesMidGroupException

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
@Test
public void testGetGroupUpdatesMidGroupException() throws Exception {
  insertUsers("User0", "User1", "User2");
  String dateStr = getNowPlusMinutes(5);
  insertModifiedGroup(dateStr, "Group0", "User0");
  insertModifiedGroup(dateStr, "Group1", "User1", "User2");
  insertModifiedGroup(dateStr, "Group2", "User2");

  testGetGroupUpdatesExceptions(Iterators.forArray(2, -1),
      NO_EXCEPTION,
      ImmutableMap.of(new GroupPrincipal("Group0", "NS_Local"),
          ImmutableSet.of(new UserPrincipal("User0", "NS")),
          new GroupPrincipal("Group1", "NS_Local"),
          ImmutableSet.of(new UserPrincipal("User1", "NS"),
              new UserPrincipal("User2", "NS")),
          new GroupPrincipal("Group2", "NS_Local"),
          ImmutableSet.of(new UserPrincipal("User2", "NS"))),
      new Checkpoint(dateStr, GROUP.pad("Group2")));
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:20,代码来源:DocumentumAdaptorTest.java

示例14: retrieveMemberIdMapping

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
private MemberIdMapping retrieveMemberIdMapping() throws IOException {
  log.entering("SiteAdaptor", "retrieveMemberIdMapping");
  Site site = siteDataClient.getContentSite();
  Map<Integer, Principal> map = new HashMap<Integer, Principal>();
  for (GroupMembership.Group group : site.getGroups().getGroup()) {
    map.put(group.getGroup().getID(), new GroupPrincipal(
        group.getGroup().getName(),
        defaultNamespace + "_" + site.getMetadata().getURL()));
  }
  for (UserDescription user : site.getWeb().getUsers().getUser()) {
    Principal principal = userDescriptionToPrincipal(user);
    if (principal == null) {
      log.log(Level.WARNING,
          "Unable to determine login name. Skipping user with ID {0}",
          user.getID());
      continue;
    }
    map.put(user.getID(), principal);
  }
  MemberIdMapping mapping = new MemberIdMapping(map);
  log.exiting("SiteAdaptor", "retrieveMemberIdMapping", mapping);
  return mapping;
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:24,代码来源:SharePointAdaptor.java

示例15: computeMembersForGroups

import com.google.enterprise.adaptor.GroupPrincipal; //导入依赖的package包/类
private Map<GroupPrincipal, Collection<Principal>> computeMembersForGroups(
    GroupMembership groups) {
  Map<GroupPrincipal, Collection<Principal>> defs
      = new HashMap<GroupPrincipal, Collection<Principal>>();
  for (GroupMembership.Group group : groups.getGroup()) {
    GroupPrincipal groupPrincipal = new GroupPrincipal(
        group.getGroup().getName(), defaultNamespace + "_" + siteUrl);
    Collection<Principal> members = new LinkedList<Principal>();
    // We always provide membership details, even for empty groups.
    defs.put(groupPrincipal, members);
    if (group.getUsers() == null) {
      continue;
    }
    for (UserDescription user : group.getUsers().getUser()) {
      Principal principal = userDescriptionToPrincipal(user);
      if (principal == null) {
        log.log(Level.WARNING,
            "Unable to determine login name. Skipping user with ID {0}",
            user.getID());
        continue;
      }
      members.add(principal);
    }
  }
  return defs;
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:27,代码来源:SharePointAdaptor.java


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