• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AccessStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testMultiNodeMethodsArg0

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

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

    AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();

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

    method.invoke(proxy, new Object[] { null, null, null, null });

    try
    {
        method.invoke(proxy, new Object[] { rootNodeRef, null, null, null });
        assertNotNull(null);
    }
    catch (InvocationTargetException e)
    {

    }

    permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ),
            "andy", AccessStatus.ALLOWED));
    method.invoke(proxy, new Object[] { rootNodeRef, null, null, null });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:ACLEntryVoterTest.java


示例17: canUserEditPost

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
/**
 * Is the current user allowed to edit this post?
 * In order to be deemed allowed, you first need write
 *  permissions on the underlying node of the post.
 * You then also need to either be the cm:creator of
 *  the post node, or a site manager
 */
protected boolean canUserEditPost(PostInfo post, SiteInfo site)
{
   // Are they OK on the node?
   AccessStatus canEdit = permissionService.hasPermission(post.getNodeRef(), PermissionService.WRITE); 
   if (canEdit == AccessStatus.ALLOWED)
   {
      // Only the creator and site managers may edit
      String user = AuthenticationUtil.getFullyAuthenticatedUser();
      if (post.getCreator().equals(user))
      {
         // It's their post
         return true;
      }
      if (site != null)
      {
         String role = siteService.getMembersRole(site.getShortName(), user);
         if (SiteServiceImpl.SITE_MANAGER.equals(role))
         {
            // Managers may edit
            return true;
         }
      }
   }
   
   // If in doubt, you may not edit
   return false;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:35,代码来源:AbstractDiscussionWebScript.java


示例18: setUp

import org.alfresco.service.cmr.security.AccessStatus; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    authenticationService = (MutableAuthenticationService) getServer().getApplicationContext().getBean("AuthenticationService");
    authenticationComponent = (AuthenticationComponent) getServer().getApplicationContext().getBean("AuthenticationComponent");
    nodeService = (NodeService) getServer().getApplicationContext().getBean("NodeService");
    contentService = (ContentService) getServer().getApplicationContext().getBean("ContentService");
    personService = (PersonService) getServer().getApplicationContext().getBean("PersonService");
    permissionService = (PermissionService) getServer().getApplicationContext().getBean("PermissionService");
    siteService = (SiteService) getServer().getApplicationContext().getBean("SiteService"); 
    repositoryHelper = (Repository) getServer().getApplicationContext().getBean("repositoryHelper");
    transactionHelper = (RetryingTransactionHelper)getServer().getApplicationContext().getBean("retryingTransactionHelper");
    fileFolderService = (FileFolderService)getServer().getApplicationContext().getBean("FileFolderService");
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
    
    createUser(USER_ONE);
    createUser(USER_TWO);
    
    AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
    
    userOneHome = repositoryHelper.getUserHome(personService.getPerson(USER_ONE));
    // no pun intended
    quickFile = AbstractContentTransformerTest.loadQuickTestFile("jpg");
    TEST_CONTENT = new byte[new Long(quickFile.length()).intValue()];
    new FileInputStream(quickFile).read(TEST_CONTENT);
    testNode = createTestFile(userOneHome, TEST_NAME, quickFile);
    
    AuthenticationUtil.setFullyAuthenticatedUser(USER_TWO);
    
    assertEquals(AccessStatus.DENIED, permissionService.hasPermission(testNode, PermissionService.READ));

    AuthenticationUtil.clearCurrentSecurityContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:35,代码来源:QuickShareRestApiTest.java


示例19: testMultiChildAssocRefMethodsArg1

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

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

    AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();

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

    method.invoke(proxy, new Object[] { null, null, null, null });

    try
    {
        method.invoke(proxy, new Object[] { null, nodeService.getPrimaryParent(rootNodeRef), null, null });
        assertNotNull(null);
    }
    catch (InvocationTargetException e)
    {

    }

    permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ),
            "andy", AccessStatus.ALLOWED));
    method.invoke(proxy, new Object[] { null, nodeService.getPrimaryParent(rootNodeRef), null, null });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:ACLEntryVoterTest.java


示例20: testMultiChildAssocRefMethodsArg3

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

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

    AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();

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

    method.invoke(proxy, new Object[] { null, null, null, null });

    try
    {
        method.invoke(proxy, new Object[] { null, null, null, nodeService.getPrimaryParent(rootNodeRef) });
        assertNotNull(null);
    }
    catch (InvocationTargetException e)
    {

    }

    permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ),
            "andy", AccessStatus.ALLOWED));
    method.invoke(proxy, new Object[] { null, null, null, nodeService.getPrimaryParent(rootNodeRef) });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:ACLEntryVoterTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ResultTreeType类代码示例发布时间:2022-05-22
下一篇:
Java IPagerTitleView类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap