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


Java AccessStatus类代码示例

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


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

示例1: getPermissions

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
/**
 * Gets the current node permissions
 * 
 * @return the permissions
 */
public List<Permission> getPermissions(NodeRef nodeRef)
{
    List<Permission> permissions = null;
    AccessStatus readPermissions = this.getPermissionService().hasPermission(nodeRef, PermissionService.READ_PERMISSIONS);
    if (readPermissions.equals(AccessStatus.ALLOWED))
    {
        List<Permission> nodePermissions = new ArrayList<Permission>();
        for (Iterator<AccessPermission> iterator = getPermissionService().getAllSetPermissions(nodeRef).iterator(); iterator
                .hasNext();)
        {
            AccessPermission ap = iterator.next();
            nodePermissions.add(new Permission(ap.getPermission(), ap.getAuthority(), ap.getAccessStatus().toString()));
        }
        permissions = nodePermissions;
    }
    else
    {
        List<Permission> noReadPermissions = new ArrayList<Permission>(1);
        noReadPermissions.add(new NoReadPermissionGranted());
        permissions = noReadPermissions;
    }
    return permissions;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:29,代码来源:NodeBrowserPost.java

示例2: validateNodeRefIsWritableSpace

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
protected final void validateNodeRefIsWritableSpace(NodeRef target)
{
    if (target == null)
    {
        throw new IllegalArgumentException("target must not be null.");
    }
    
    if (!fileFolderService.exists(target))
    {
        throw new IllegalArgumentException("Target '" + target.toString() + "' doesn't exist.");
    }
    
    if (AccessStatus.DENIED.equals(permissionService.hasPermission(target, PermissionService.ADD_CHILDREN)))
    {
        throw new IllegalArgumentException("Target '" + target.toString() + "' is not writeable.");
    }
    
    if (!fileFolderService.getFileInfo(target).isFolder())
    {
        throw new IllegalArgumentException("Target '" + target.toString() + "' is not a space.");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:AbstractBulkFilesystemImporter.java

示例3: testBasicAllowNodePair

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
public void testBasicAllowNodePair() throws Exception
{
    runAs("andy");

    Object o = new ClassWithMethods();
    Method method = o.getClass().getMethod("echoNodePair", new Class[] { NodeRef.class });

    AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();

    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
    proxyFactory.setTargetSource(new SingletonTargetSource(o));
    Object proxy = proxyFactory.getProxy();

    permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));

    Pair<Long, NodeRef> rootNodePair = new Pair<Long, NodeRef>(Long.valueOf(1), rootNodeRef);
    Object answer = method.invoke(proxy, new Object[] { rootNodeRef });
    assertEquals(rootNodePair, answer);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:ACLEntryAfterInvocationTest.java

示例4: testAclInsertionPerformanceMixed

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
@Category(PerformanceTests.class)
public void testAclInsertionPerformanceMixed()
{
    NodeRef parent = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}one"), ContentModel.TYPE_FOLDER).getChildRef();
    for(int i = 0; i < 1000; i++)
    {
        NodeRef created = nodeService.createNode(parent, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}child"+i), ContentModel.TYPE_FOLDER).getChildRef();
        if(i % 2 == 0)
        {
            permissionService.setPermission(new SimplePermissionEntry(created, getPermission(PermissionService.CONSUMER), "bob", AccessStatus.ALLOWED));
        }
    }
    long start = System.nanoTime();
    permissionService.setPermission(new SimplePermissionEntry(parent, getPermission(PermissionService.CONSUMER), "andy", AccessStatus.ALLOWED));
    long end = System.nanoTime();

    //assertTrue("Time was "+(end - start)/1000000000.0f, end == start);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:PermissionServiceTest.java

示例5: getPersonIfAllowed

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
private TemplateNode getPersonIfAllowed(final String userName)
{
    final PersonService personService = serviceRegistry.getPersonService();
    NodeRef inviterRef = AuthenticationUtil.runAs(new RunAsWork<NodeRef>()
    {
        public NodeRef doWork() throws Exception
        {
            if (!personService.personExists(userName))
            {
                return null;
            }
            return personService.getPerson(userName, false);
        }
    }, AuthenticationUtil.getSystemUserName());
    if (inviterRef != null
            && serviceRegistry.getPermissionService().hasPermission(inviterRef, PermissionService.READ_PROPERTIES)
                    .equals(AccessStatus.ALLOWED))
    {
        return new TemplateNode(inviterRef, serviceRegistry, null);
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:Invites.java

示例6: testUpdatePermissionInvalidName

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
/**
 * Test attempt to set permission with an invalid name
 *
 * @throws Exception
 */
private void testUpdatePermissionInvalidName() throws Exception
{
    // create folder with an empty document
    String postUrl = createFolder();
    String dId = createDocument(postUrl);

    // update permissions
    Document dUpdate = new Document();
    NodePermissions nodePermissions = new NodePermissions();
    List<NodePermissions.NodePermission> locallySetPermissions = new ArrayList<>();
    locallySetPermissions.add(new NodePermissions.NodePermission(groupA, "InvalidName", AccessStatus.DENIED.toString()));
    nodePermissions.setLocallySet(locallySetPermissions);
    dUpdate.setPermissions(nodePermissions);

    // "Cannot set permissions on this node - unknown permission name:
    // InvalidName"
    put(URL_NODES, dId, toJsonAsStringNonNull(dUpdate), null, 400);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:NodeApiTest.java

示例7: testPermissionWithNoLockAspect

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
/**
 * 
 */
public void testPermissionWithNoLockAspect()
{
    authenticationService.authenticate("andy", "andy".toCharArray());
    NodeRef testNode = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_PERSON,
            ContentModel.TYPE_CMOBJECT, null).getChildRef();
    assertNotNull(testNode);
    permissionService.setPermission(rootNodeRef, "andy", PermissionService.ALL_PERMISSIONS, true);
 
    assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rootNodeRef,
            PermissionService.LOCK));
    assertEquals(AccessStatus.DENIED, permissionService.hasPermission(rootNodeRef,
            PermissionService.UNLOCK));
    assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rootNodeRef, PermissionService.CHECK_OUT));
    assertEquals(AccessStatus.DENIED, permissionService.hasPermission(rootNodeRef, PermissionService.CHECK_IN));
    assertEquals(AccessStatus.DENIED, permissionService.hasPermission(rootNodeRef, PermissionService.CANCEL_CHECK_OUT));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:LockOwnerDynamicAuthorityTest.java

示例8: testEqualBarCaseAuthorities

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
public void testEqualBarCaseAuthorities()
{

    runAs(AuthenticationUtil.getAdminUserName());

    NodeRef n1 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}one"), ContentModel.TYPE_FOLDER).getChildRef();

    permissionService.setPermission(new SimplePermissionEntry(n1, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));   
    permissionService.setPermission(new SimplePermissionEntry(n1, getPermission(PermissionService.READ), "Andy", AccessStatus.ALLOWED));   
    permissionService.setPermission(new SimplePermissionEntry(n1, getPermission(PermissionService.READ), "ANDY", AccessStatus.ALLOWED)); 
    permissionService.setPermission(new SimplePermissionEntry(n1, getPermission(PermissionService.READ), "woof/adobe", AccessStatus.ALLOWED)); 
    permissionService.setPermission(new SimplePermissionEntry(n1, getPermission(PermissionService.READ), "woof/Adobe", AccessStatus.ALLOWED)); 
    permissionService.setPermission(new SimplePermissionEntry(n1, getPermission(PermissionService.READ), "woof/ADOBE", AccessStatus.ALLOWED)); 
    permissionService.setPermission(new SimplePermissionEntry(n1, getPermission(PermissionService.READ), "Woof/Adobe", AccessStatus.ALLOWED)); 
    permissionService.setPermission(new SimplePermissionEntry(n1, getPermission(PermissionService.READ), "WOOF/ADOBE", AccessStatus.ALLOWED)); 

    assertEquals(8, permissionService.getAllSetPermissions(n1).size());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:PermissionServiceTest.java

示例9: execute

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
@Override
public AccessStatus execute(VirtualProtocol virtualProtocol, Reference reference) throws ProtocolMethodException
{
    VirtualFolderDefinition definition = resolver.resolveVirtualFolderDefinition(reference);
    FilingRule filingRule = definition.getFilingRule();

    boolean readonly = filingRule.isNullFilingRule()
                || filingRule.filingNodeRefFor(new FilingParameters(reference)) == null;
    if (readonly)
    {
        Set<String> deniedPermissions = userPermissions.getDenyReadonlySmartNodes();
        if (deniedPermissions.contains(permissionToCheck))
        {
            return AccessStatus.DENIED;
        }
        
        if (PermissionService.READ.equals(permissionToCheck))
        {
            return AccessStatus.ALLOWED;
        }
    }

    return userPermissions.hasVirtualNodePermission(permissionToCheck,
                                                    readonly);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:HasPermissionMethod.java

示例10: testAdminUserPermissions

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
public void testAdminUserPermissions()
{
    runAs(AuthenticationUtil.getAdminUserName());
    try
    {
        assertFalse(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CONSUMER) == AccessStatus.ALLOWED);
        assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.DELETE) == AccessStatus.ALLOWED);
        assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.READ) == AccessStatus.ALLOWED);
        assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED);
        assertFalse(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CANCEL_CHECK_OUT) == AccessStatus.ALLOWED);
        assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CHECK_OUT) == AccessStatus.ALLOWED);
        assertFalse(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.COORDINATOR) == AccessStatus.ALLOWED);

    }
    finally
    {
        AuthenticationUtil.clearCurrentSecurityContext();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:PermissionServiceTest.java

示例11: setPermission

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
public void setPermission(NodeRef nodeRef, String authority, PermissionReference permission, boolean allow)
{
    CreationReport report = null;
    try
    {
        report = getMutableAccessControlList(nodeRef);
    }
    catch (InvalidNodeRefException e)
    {
        return;
    }
    if (report.getCreated() != null)
    {
        SimpleAccessControlEntry entry = new SimpleAccessControlEntry();
        entry.setAuthority(authority);
        entry.setPermission(permission);
        entry.setAccessStatus(allow ? AccessStatus.ALLOWED : AccessStatus.DENIED);
        entry.setAceType(ACEType.ALL);
        entry.setPosition(Integer.valueOf(0));
        List<AclChange> changes = aclDaoComponent.setAccessControlEntry(report.getCreated().getId(), entry);
        List<AclChange> all = new ArrayList<AclChange>(changes.size() + report.getChanges().size());
        all.addAll(report.getChanges());
        all.addAll(changes);
        getACLDAO(nodeRef).updateChangedAcls(nodeRef, all);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:AbstractPermissionsDaoComponentImpl.java

示例12: testBasicAllowChildAssociationRef2

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
public void testBasicAllowChildAssociationRef2() throws Exception
{
    runAs("andy");

    Object o = new ClassWithMethods();
    Method method = o.getClass().getMethod("echoChildAssocRef", new Class[] { ChildAssociationRef.class });

    AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();

    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_PARENT.sys:base.Read")));
    proxyFactory.setTargetSource(new SingletonTargetSource(o));
    Object proxy = proxyFactory.getProxy();

    permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));

    Object answer = method.invoke(proxy, new Object[] { nodeService.getPrimaryParent(rootNodeRef) });
    assertEquals(answer, nodeService.getPrimaryParent(rootNodeRef));

    answer = method.invoke(proxy, new Object[] { nodeService.getPrimaryParent(systemNodeRef) });
    assertEquals(answer, nodeService.getPrimaryParent(systemNodeRef));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:ACLEntryAfterInvocationTest.java

示例13: createAce

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
public Ace createAce(Permission permission, Authority authority, ACEType type, AccessStatus accessStatus)
{
    ParameterCheck.mandatory("permission", permission);
    ParameterCheck.mandatory("authority", authority);
    ParameterCheck.mandatory("type", type);
    ParameterCheck.mandatory("accessStatus", accessStatus);
    
    AceEntity entity = new AceEntity();
    
    entity.setApplies(type.getId()); // note: 'applies' stores the ACE type
    entity.setAllowed((accessStatus == AccessStatus.ALLOWED) ? true : false);
    entity.setAuthorityId(authority.getId());
    entity.setPermissionId(permission.getId());
    
    long aceId = createAceEntity(entity);
    
    entity.setVersion(0L);
    entity.setId(aceId);
    
    return entity;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:AbstractAclCrudDAOImpl.java

示例14: testAclInsertionPerformanceDefining

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
@Category(PerformanceTests.class)
public void testAclInsertionPerformanceDefining()
{
    NodeRef parent = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}one"), ContentModel.TYPE_FOLDER).getChildRef();
    for(int i = 0; i < 1000; i++)
    {
        NodeRef created = nodeService.createNode(parent, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}child"+i), ContentModel.TYPE_FOLDER).getChildRef();
        permissionService.setPermission(new SimplePermissionEntry(created, getPermission(PermissionService.CONSUMER), "bob", AccessStatus.ALLOWED));
    }
    long start = System.nanoTime();
    permissionService.setPermission(new SimplePermissionEntry(parent, getPermission(PermissionService.CONSUMER), "andy", AccessStatus.ALLOWED));
    long end = System.nanoTime();

    //assertTrue("Time was "+(end - start)/1000000000.0f, end == start);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:PermissionServiceTest.java

示例15: isAllowed

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
public boolean isAllowed(CMISNodeInfo nodeInfo)
{
    for (String permission : permissions)
    {
        if (permissionService.hasPermission(nodeInfo.getNodeRef(), permission) == AccessStatus.DENIED)
        {
            return false;
        }
    }
    return true;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:PermissionActionEvaluator.java


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