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


Java AuthorityService类代码示例

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


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

示例1: setUp

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{  
    AuthenticationUtil.setRunAsUserSystem();
    nodeService = (NodeService)ctx.getBean("NodeService");
    assertNotNull("nodeService", nodeService);
    authorityService = (AuthorityService)ctx.getBean("AuthorityService");
    assertNotNull("authorityService", authorityService);
    ChildApplicationContextFactory emailSubsystem = (ChildApplicationContextFactory) ctx.getBean("InboundSMTP");
    assertNotNull("emailSubsystem", emailSubsystem);
    ApplicationContext emailCtx = emailSubsystem.getApplicationContext();
    emailService = (EmailService)emailCtx.getBean("emailService");       
    assertNotNull("emailService", emailService);
    personService = (PersonService)emailCtx.getBean("PersonService");       
    assertNotNull("personService", personService);     
    namespaceService = (NamespaceService)emailCtx.getBean("NamespaceService");       
    assertNotNull("namespaceService", namespaceService);
    searchService = (SearchService)emailCtx.getBean("SearchService");  
    assertNotNull("searchService", searchService);
    folderEmailMessageHandler = (FolderEmailMessageHandler) emailCtx.getBean("folderEmailMessageHandler");  
    assertNotNull("folderEmailMessageHandler", folderEmailMessageHandler);
    transactionHelper = (RetryingTransactionHelper) emailCtx.getBean("retryingTransactionHelper");
    assertNotNull("transactionHelper", transactionHelper);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:EmailServiceImplTest.java

示例2: collectData

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
@Override
public List<HBData> collectData()
{
    this.logger.debug("Preparing repository usage (authorities) data...");

    Map<String, Object> authoritiesUsageValues = new HashMap<>();
    authoritiesUsageValues.put("numUsers", new Integer(this.authorityService.getAllAuthoritiesInZone(
            AuthorityService.ZONE_APP_DEFAULT, AuthorityType.USER).size()));
    authoritiesUsageValues.put("numGroups", new Integer(this.authorityService.getAllAuthoritiesInZone(
            AuthorityService.ZONE_APP_DEFAULT, AuthorityType.GROUP).size()));
    HBData authoritiesUsageData = new HBData(
            this.currentRepoDescriptorDAO.getDescriptor().getId(),
            this.getCollectorId(),
            this.getCollectorVersion(),
            new Date(),
            authoritiesUsageValues);

    return Arrays.asList(authoritiesUsageData);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:AuthoritiesDataCollector.java

示例3: updateAuthorityZones

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
/**
 * Modifies an authority's zone set from oldZones to newZones in the most efficient manner (avoiding unnecessary
 * reindexing cost).
 */
private void updateAuthorityZones(String authorityName, Set<String> oldZones, final Set<String> newZones)
{
    Set<String> zonesToRemove = new HashSet<String>(oldZones);
    zonesToRemove.removeAll(newZones);
    // Let's keep the authority in the alfresco auth zone if it was already there. Otherwise we may have to
    // regenerate all paths to this authority from site groups, which could be very expensive!
    zonesToRemove.remove(AuthorityService.ZONE_AUTH_ALFRESCO);
    if (!zonesToRemove.isEmpty())
    {
        this.authorityService.removeAuthorityFromZones(authorityName, zonesToRemove);
    }
    Set<String> zonesToAdd = new HashSet<String>(newZones);
    zonesToAdd.removeAll(oldZones);
    if (!zonesToAdd.isEmpty())
    {
        this.authorityService.addAuthorityToZones(authorityName, zonesToAdd);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:ChainingUserRegistrySynchronizer.java

示例4: GetPeopleCannedQuery

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
public GetPeopleCannedQuery(
        NodeDAO nodeDAO,
        QNameDAO qnameDAO,
        CannedQueryDAO cannedQueryDAO,
        TenantService tenantService,
        NodeService nodeService,
        AuthorityService authorityService,
        CannedQueryParameters params)
{
    super(params);
    
    this.nodeDAO = nodeDAO;
    this.qnameDAO = qnameDAO;
    this.cannedQueryDAO = cannedQueryDAO;
    this.tenantService = tenantService;
    this.nodeService = nodeService;
    this.authorityService = authorityService;
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:GetPeopleCannedQuery.java

示例5: getContainerGroups

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
/**
 * Gets the groups that contain the specified authority
 * 
 * @param person       the user (cm:person) to get the containing groups for
 * 
 * @return the containing groups as a JavaScript array
 */
public Scriptable getContainerGroups(ScriptNode person)
{
    ParameterCheck.mandatory("Person", person);
    Object[] parents = null;
    Set<String> authorities = this.authorityService.getContainingAuthoritiesInZone(
            AuthorityType.GROUP,
            (String)person.getProperties().get(ContentModel.PROP_USERNAME),
            AuthorityService.ZONE_APP_DEFAULT, null, 1000);
    parents = new Object[authorities.size()];
    int i = 0;
    for (String authority : authorities)
    {
        ScriptNode group = getGroup(authority);
        if (group != null)
        {
            parents[i++] = group; 
        }
    }
    return Context.getCurrentContext().newArray(getScope(), parents);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:People.java

示例6: getContainerGroups

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
/**
 * Gets the groups that contain the specified authority
 * 
 * @param person       the user (cm:person) to get the containing groups for
 * 
 * @return the containing groups as a List of TemplateNode objects, can be null
 */
public List<TemplateNode> getContainerGroups(TemplateNode person)
{
    ParameterCheck.mandatory("Person", person);
    List<TemplateNode> parents;
    Set<String> authorities = this.authorityService.getContainingAuthoritiesInZone(
            AuthorityType.GROUP,
            (String)person.getProperties().get(ContentModel.PROP_USERNAME),
            AuthorityService.ZONE_APP_DEFAULT, null, 1000);
    parents = new ArrayList<TemplateNode>(authorities.size());
    for (String authority : authorities)
    {
        TemplateNode group = getGroup(authority);
        if (group != null)
        {
            parents.add(group); 
        }
    }
    return parents;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:People.java

示例7: setUp

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
@Before
public void setUp()
{
    HBDataCollectorService mockCollectorService = mock(HBDataCollectorService.class);
    AuthorityService authorityService = mock(AuthorityService.class);

    Descriptor mockDescriptor = mock(Descriptor.class);
    when(mockDescriptor.getId()).thenReturn("mock_id");
    DescriptorDAO descriptorDAO = mock(DescriptorDAO.class);
    when(descriptorDAO.getDescriptor()).thenReturn(mockDescriptor);

    authorityDataCollector = new AuthoritiesDataCollector("acs.repository.usage.authorities", "1.0", "0 0 0 ? * *");
    authorityDataCollector.setAuthorityService(authorityService);
    authorityDataCollector.setCurrentRepoDescriptorDAO(descriptorDAO);
    authorityDataCollector.setHbDataCollectorService(mockCollectorService);
    collectedData = authorityDataCollector.collectData();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AuthoritiesDataCollectorTest.java

示例8: testGetAuthoritiesForZone

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
public void testGetAuthoritiesForZone() 
{
    String role = pubAuthorityService.createAuthority(AuthorityType.ROLE, "one");
    String group = pubAuthorityService.createAuthority(AuthorityType.GROUP, "group1");
    String user = "[email protected]" + System.currentTimeMillis();
    createUserAuthority(user);

    PagingResults<String> authorities = authorityService.getAuthorities(null, AuthorityService.ZONE_APP_DEFAULT, "*", false, false, new PagingRequest(100));
    assertTrue(authorities.getPage().contains(user));
    assertTrue(authorities.getPage().contains(role));
    assertTrue(authorities.getPage().contains(group));
    
    PagingResults<String> groups = authorityService.getAuthorities(AuthorityType.GROUP, AuthorityService.ZONE_APP_DEFAULT, "*", false, false, new PagingRequest(100));
    assertTrue(groups.getPage().contains(group));
    assertFalse(groups.getPage().contains(user));
    assertFalse(groups.getPage().contains(role));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AuthorityServiceTest.java

示例9: setUp

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    transactionService = (TransactionService) ctx.getBean(ServiceRegistry.TRANSACTION_SERVICE.getLocalName());
    authorityService = (AuthorityService) ctx.getBean(ServiceRegistry.AUTHORITY_SERVICE.getLocalName());
    tenantAdminService = ctx.getBean("tenantAdminService", TenantAdminService.class);
    personService = (PersonService) ctx.getBean(ServiceRegistry.PERSON_SERVICE.getLocalName());
    tenantService = (TenantService) ctx.getBean("tenantService");
    authorityBridgeTableCache = (AuthorityBridgeTableAsynchronouslyRefreshedCache) ctx.getBean("authorityBridgeTableCache");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AuthorityBridgeTableAsynchronouslyRefreshedCacheTest.java

示例10: dontTestAssocs

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
/**
 * Tests synchronization of group associations in a zone with a larger volume of authorities.
 * 
 * @throws Exception
 *             the exception
 */
public void dontTestAssocs() throws Exception
{
    List<NodeDescription> groups = this.retryingTransactionHelper.doInTransaction(
            new RetryingTransactionCallback<List<NodeDescription>>()
            {

                public List<NodeDescription> execute() throws Throwable
                {
                    return new ArrayList<NodeDescription>(new RandomGroupCollection(1000,
                            ChainingUserRegistrySynchronizerTest.this.authorityService.getAllAuthoritiesInZone(
                                    AuthorityService.ZONE_AUTH_EXT_PREFIX + "Z0", null)));
                }
            }, true, true);
    ChainingUserRegistrySynchronizerTest.this.applicationContextManager.setUserRegistries(new MockUserRegistry(
            "Z0", Collections.<NodeDescription> emptyList(), groups));
    ChainingUserRegistrySynchronizerTest.this.synchronizer.synchronize(true, true);
    tearDownTestUsersAndGroups();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ChainingUserRegistrySynchronizerTest.java

示例11: createGroupIfNotExist

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
/**
 * Creates a group with the given name if one does not already exist.
 * @param groupShortName String
 * @return The group's full name.
 */
public String createGroupIfNotExist(String groupShortName)
{
    String fullName = authorityService.getName(AuthorityType.GROUP, groupShortName);
    if (groups.containsKey(groupShortName) == false)
    {
        if (authorityService.authorityExists(fullName) == false)
        {
            Set<String> zones = new HashSet<String>(2, 1.0f);
            zones.add(AuthorityService.ZONE_APP_DEFAULT);
            fullName = authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, zones);
            groups.put(groupShortName, findGroupNode(groupShortName));
        }
    }
    return fullName;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:TestGroupManager.java

示例12: setUp

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    
    this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
    this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
    this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
    this.authorityService = (AuthorityService)getServer().getApplicationContext().getBean("AuthorityService");
    
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    // Create users
    createUser(USER_ONE);
    createUser(USER_TWO);
    createUser(USER_THREE);
    
    // Do tests as user one
    this.authenticationComponent.setCurrentUser(USER_ONE);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:21,代码来源:GroupsTest.java

示例13: setUp

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    
    this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
    this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService");
    this.permissionService = (PermissionService)getServer().getApplicationContext().getBean("PermissionService");
    this.authorityService = (AuthorityService)getServer().getApplicationContext().getBean("AuthorityService");
    this.fileFolderService = (FileFolderService)getServer().getApplicationContext().getBean("FileFolderService");

    
    // Create users
    createUser(USER_ONE);
    createUser(USER_TWO);
    createUser(USER_THREE);
    createUser(USER_NUMERIC);
    createUser(USER_FOUR_AS_SITE_ADMIN);
    
    // Add user four as a member of the site admins group
    authorityService.addAuthority("GROUP_SITE_ADMINISTRATORS", USER_FOUR_AS_SITE_ADMIN);
    
    // Do tests as user one
    this.authenticationComponent.setCurrentUser(USER_ONE);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:SiteServiceTest.java

示例14: setup

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
@Before
public void setup() throws Exception 
{
    super.setup();

    permissionService = applicationContext.getBean("permissionService", PermissionService.class);
    authorityService = (AuthorityService) applicationContext.getBean("AuthorityService");
    auditService = applicationContext.getBean("AuditService", AuditService.class);

    AuditModelRegistryImpl auditModelRegistry = (AuditModelRegistryImpl) applicationContext.getBean("auditModel.modelRegistry");

    // Register the test model
    URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/audit/alfresco-audit-access.xml");
    auditModelRegistry.registerModel(testModelUrl);
    auditModelRegistry.loadAuditModels();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:AuditAppTest.java

示例15: setup

import org.alfresco.service.cmr.security.AuthorityService; //导入依赖的package包/类
@Before
public void setup() throws Exception
{
    authenticationService = applicationContext.getBean("authenticationService", MutableAuthenticationService.class);
    personService = applicationContext.getBean("personService", PersonService.class);
    customModelService = applicationContext.getBean("customModelService", CustomModelService.class);

    final AuthorityService authorityService = applicationContext.getBean("authorityService", AuthorityService.class);

    this.nonAdminUserName = createUser("nonAdminUser" + System.currentTimeMillis(), "password", null);
    this.customModelAdmin = createUser("customModelAdmin" + System.currentTimeMillis(), "password", null);
    users.add(nonAdminUserName);
    users.add(customModelAdmin);
    
    // Add 'customModelAdmin' user into 'ALFRESCO_MODEL_ADMINISTRATORS' group
    transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        @Override
        public Void execute() throws Throwable
        {
            authorityService.addAuthority(CustomModelServiceImpl.GROUP_ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY, customModelAdmin);
            return null;
        }
    });
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:BaseCustomModelApiTest.java


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