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

Java Ace类代码示例

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

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



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

示例1: create2TestACLs

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
/**
 * 
 * @param session Session
 * @return List<Ace>
 */
private List<Ace> create2TestACLs(Session session)
{
    List<Ace> newACE = new ArrayList<Ace>();
    LinkedList<String> permissions1 = new LinkedList<String>();
    permissions1.add("{http://www.alfresco.org/model/system/1.0}base.ReadPermissions");

    LinkedList<String> permissions2 = new LinkedList<String>();
    permissions2.add("{http://www.alfresco.org/model/system/1.0}base.Unlock");

    Ace ace1 = session.getObjectFactory().createAce("testUser1", permissions1);
    Ace ace2 = session.getObjectFactory().createAce("testUser2", permissions2);
    newACE.add(ace1);
    newACE.add(ace2);
    return newACE;

}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:TestRemovePermissions.java


示例2: createFolder

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
private ObjectId createFolder(Session session, ObjectId parentId, String folderName) {
	ObjectId mainFolderID = null;

	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_FOLDER.value());

	properties.put(PropertyIds.NAME, folderName);

	List<Ace> addAces = new LinkedList<Ace>();
	List<Ace> removeAces = new LinkedList<Ace>();
	List<Policy> policies = new LinkedList<Policy>();

	// create the folder if it doesn't exists
	mainFolderID = session.createFolder(properties, parentId, policies, addAces, removeAces);
	// session.save();

	return mainFolderID;
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:19,代码来源:CMISExporter.java


示例3: getPermissionsImpl

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
protected String[] getPermissionsImpl(final boolean directOnly)
{
    final String[] result;

    final Acl acl = this.object.getAcl();
    final List<Ace> aces = acl.getAces();

    final List<String> permissions = new ArrayList<String>();

    for (final Ace ace : aces)
    {
        if (ace.isDirect() || !directOnly)
        {
            for (final String permission : ace.getPermissions())
            {
                final String permissionStr = MessageFormat.format("ALLOWED;{0};{1}", ace.getPrincipalId(), permission);
                permissions.add(permissionStr);
            }
        }
    }

    result = permissions.toArray(new String[0]);

    return result;
}
 
开发者ID:AFaust,项目名称:alfresco-cmis-documentlist,代码行数:26,代码来源:BaseCMISObject.java


示例4: excludeInheritedAces

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
/**
 * Filter acl to ignore inherited ACEs
 *
 * @param nodeRef NodeRef
 * @param acl Acl
 * @return Acl
 */
protected Acl excludeInheritedAces(NodeRef nodeRef, Acl acl)
{

    List<Ace> newAces = new ArrayList<Ace>();
    Acl allACLs = getACL(nodeRef, false);

    Map<String, Set<String>> originalsAcls = convertAclToMap(allACLs);
    Map<String, Set<String>> newAcls = convertAclToMap(acl);

    // iterate through the original ACEs
    for (Map.Entry<String, Set<String>> ace : originalsAcls.entrySet())
    {

        // add permissions
        Set<String> addPermissions = newAcls.get(ace.getKey());
        if (addPermissions != null)
        {
            ace.getValue().addAll(addPermissions);
        }

        // create new ACE
        if (!ace.getValue().isEmpty())
        {
            newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace
                    .getKey()), new ArrayList<String>(ace.getValue())));
        }
    }

    return new AccessControlListImpl(newAces);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:CMISConnector.java


示例5: applyACL

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
/**
 * Sets the given ACL.
 */
public void applyACL(NodeRef nodeRef, TypeDefinitionWrapper type, Acl aces)
{
    boolean hasAces = (aces != null) && (aces.getAces() != null) && !aces.getAces().isEmpty();

    if (!hasAces && !permissionService.getInheritParentPermissions(nodeRef))
    {
        return;
    }

    if (!type.getTypeDefinition(false).isControllableAcl())
    {
        throw new CmisConstraintException("Object is not ACL controllable!");
    }

    // remove all permissions
    permissionService.deletePermissions(nodeRef);

    // set new permissions
    for (Ace ace : aces.getAces())
    {
        String principalId = ace.getPrincipalId();
        if (CMIS_USER.equals(principalId))
        {
            principalId = AuthenticationUtil.getFullyAuthenticatedUser();
        }

        List<String> permissions = translatePermissionsFromCMIS(ace.getPermissions());
        for (String permission : permissions)
        {
            permissionService.setPermission(nodeRef, principalId, permission, true);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:CMISConnector.java


示例6: testCreate

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
public void testCreate()
{
    Session session = getSession("admin", "admin");
    
    String folderName = getRootFolderName();
    Folder root = session.getRootFolder();
    
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
    properties.put(PropertyIds.NAME, folderName);

    // create the folder
    Folder newFolder = root.createFolder(properties);
    
    for(int i = 0; i < 50; i++)
    {
        AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl("user"+i);
        List<String> permissions = new ArrayList<String>(1);
        permissions.add(BasicPermissions.READ);
        List<Ace> addAces = new ArrayList<Ace>(1);
        addAces.add(new AccessControlEntryImpl(principal, permissions));
        newFolder.addAcl(addAces, AclPropagation.PROPAGATE);
        
        Map<String, Object> updateProperties = new HashMap<String, Object>();
        updateProperties.put("cm:title", "Update title "+i);
        newFolder.updateProperties(properties);
        
        if(i % 10 == 0)
        {
            System.out.println("@ "+i);
        }
    }
    ItemIterable<QueryResult> result = session.query("select * from cmis:folder", false);
    assertTrue(result.getTotalNumItems() > 0);
    
    result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false);
    assertTrue(result.getTotalNumItems() > 0);
    
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:40,代码来源:CMISDataCreatorTest.java


示例7: excludeInheritedAces

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
/**
 * Filter acl to ignore inherited ACEs
 * 
 * @param nodeRef NodeRef
 * @param acl Acl
 * @return Acl
 */
protected Acl excludeInheritedAces(NodeRef nodeRef, Acl acl)
{

    List<Ace> newAces = new ArrayList<Ace>();
    Acl allACLs = getACL(nodeRef, false);

    Map<String, Set<String>> originalsAcls = convertAclToMap(allACLs);
    Map<String, Set<String>> newAcls = convertAclToMap(acl);

    // iterate through the original ACEs
    for (Map.Entry<String, Set<String>> ace : originalsAcls.entrySet())
    {

        // add permissions
        Set<String> addPermissions = newAcls.get(ace.getKey());
        if (addPermissions != null)
        {
            ace.getValue().addAll(addPermissions);
        }

        // create new ACE
        if (!ace.getValue().isEmpty())
        {
            newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace
                    .getKey()), new ArrayList<String>(ace.getValue())));
        }
    }

    return new AccessControlListImpl(newAces);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:38,代码来源:CMISConnector.java


示例8: compileAcl

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
/**
 * Compiles the ACL for a file or folder.
 */
private Acl compileAcl(File file) {
    AccessControlListImpl result = new AccessControlListImpl();
    result.setAces(new ArrayList<Ace>());

    for (Map.Entry<String, Boolean> ue : readWriteUserMap.entrySet()) {
        // create principal
        AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl(ue.getKey());

        // create ACE
        AccessControlEntryImpl entry = new AccessControlEntryImpl();
        entry.setPrincipal(principal);
        entry.setPermissions(new ArrayList<String>());
        entry.getPermissions().add(BasicPermissions.READ);
        if (!ue.getValue().booleanValue() && file.canWrite()) {
            entry.getPermissions().add(BasicPermissions.WRITE);
            entry.getPermissions().add(BasicPermissions.ALL);
        }

        entry.setDirect(true);

        // add ACE
        result.getAces().add(entry);
    }

    return result;
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:30,代码来源:FileBridgeRepository.java


示例9: compileAcl

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
/**
 * Compiles the ACL for a file or folder.
 */
private Acl compileAcl(File file) {
	AccessControlListImpl result = new AccessControlListImpl();
	result.setAces(new ArrayList<Ace>());

	for (Map.Entry<String, Boolean> ue : readWriteUserMap.entrySet()) {
		// create principal
		AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl();
		principal.setPrincipalId(ue.getKey());

		// create ACE
		AccessControlEntryImpl entry = new AccessControlEntryImpl();
		entry.setPrincipal(principal);
		entry.setPermissions(new ArrayList<String>());
		entry.getPermissions().add(CMIS_READ);
		if (!ue.getValue().booleanValue() && file.canWrite()) {
			entry.getPermissions().add(CMIS_WRITE);
			entry.getPermissions().add(CMIS_ALL);
		}

		entry.setDirect(true);

		// add ACE
		result.getAces().add(entry);
	}

	return result;
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:31,代码来源:FileBridgeRepository.java


示例10: convertAclToMap

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
/**
 * Converts Acl to map and ignore the indirect ACEs
 *
 * @param acl Acl
 * @return Map
 */
private Map<String, Set<String>> convertAclToMap(Acl acl)
{
    Map<String, Set<String>> result = new HashMap<String, Set<String>>();

    if (acl == null || acl.getAces() == null)
    {
        return result;
    }

    for (Ace ace : acl.getAces())
    {
        // don't consider indirect ACEs - we can't change them
        if (!ace.isDirect())
        {
            // ignore
            continue;
        }

        // although a principal must not be null, check it
        if (ace.getPrincipal() == null || ace.getPrincipal().getId() == null)
        {
            // ignore
            continue;
        }

        Set<String> permissions = result.get(ace.getPrincipal().getId());
        if (permissions == null)
        {
            permissions = new HashSet<String>();
            result.put(ace.getPrincipal().getId(), permissions);
        }

        if (ace.getPermissions() != null)
        {
            permissions.addAll(ace.getPermissions());
        }
    }

    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:47,代码来源:CMISConnector.java


示例11: testRemoveAllPermissions_WEBSERVICE_10

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
/**
 * cmisws?wsdl is not available using jetty in automated test suite should
 * be runned using an external alfresco server
 * 
 */
// @Test
public void testRemoveAllPermissions_WEBSERVICE_10()
{
    Folder testFolder = null;
    try
    {
        Session session = getWEBSERVICE_10_Session();
        if (session == null)
        {
            fail("WEBSERVICE 1.0 session cannot be null");
        }
        testFolder = createFolder(session, "testRemoveAllPermissions_WEBSERVICE_10");
        List<Ace> acl = create2TestACLs(session);

        // adding new ACE
        testFolder.addAcl(acl, AclPropagation.PROPAGATE);

        Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false);
        int oldSize = allacl.getAces().size();

        // Removing ALL ACEs
        Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE);

        int newsize = newAcl.getAces().size();

        System.out.println("Old ace size -->" + oldSize);
        System.out.println("New ace size --> " + newsize);

        assertTrue(newsize == oldSize - acl.size());
    }
    catch (Exception ex)
    {
        fail(ex.getMessage());
    }
    finally
    {
        if (testFolder != null)
        {
            testFolder.delete();
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:48,代码来源:TestRemovePermissions.java


示例12: testRemoveAllPermissions_ATOMPUB_10

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Test
public void testRemoveAllPermissions_ATOMPUB_10()
{
    Folder testFolder = null;
    try
    {
        Session session = getATOMPUB_10_Session();
        if (session == null)
        {
            fail("ATOMPUB 1.0 session cannot be null");
        }
        testFolder = createFolder(session, "testRemoveAllPermissions_ATOMPUB_10");
        List<Ace> acl = create2TestACLs(session);

        // adding new ACE
        testFolder.addAcl(acl, AclPropagation.PROPAGATE);

        Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false);
        int oldSize = allacl.getAces().size();

        // Removing ALL ACEs
        Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE);

        int newsize = newAcl.getAces().size();

        System.out.println("Old ace size -->" + oldSize);
        System.out.println("New ace size --> " + newsize);

        assertTrue(newsize == oldSize - acl.size());
    }
    catch (Exception ex)
    {
        fail(ex.getMessage());
    }
    finally
    {
        if (testFolder != null)
        {
            testFolder.delete();
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:43,代码来源:TestRemovePermissions.java


示例13: testRemoveAllPermissions_ATOMPUB_11

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Test
public void testRemoveAllPermissions_ATOMPUB_11()
{
    Folder testFolder = null;
    try
    {
        Session session = getATOMPUB_11_Session();
        if (session == null)
        {
            fail("ATOMPUB 1.1 session cannot be null");
        }
        testFolder = createFolder(session, "testRemoveAllPermissions_ATOMPUB_11");
        List<Ace> acl = create2TestACLs(session);

        // adding new ACE
        testFolder.addAcl(acl, AclPropagation.PROPAGATE);

        Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false);
        int oldSize = allacl.getAces().size();

        // Removing ALL ACEs
        Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE);

        int newsize = newAcl.getAces().size();

        System.out.println("Old ace size -->" + oldSize);
        System.out.println("New ace size --> " + newsize);

        assertTrue(newsize == oldSize - acl.size());
    }
    catch (Exception ex)
    {
        fail(ex.getMessage());
    }
    finally
    {
        if (testFolder != null)
        {
            testFolder.delete();
        }
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:44,代码来源:TestRemovePermissions.java


示例14: testRemoveAllPermissions_BROWSER_11

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Test
public void testRemoveAllPermissions_BROWSER_11()
{
    Folder testFolder = null;
    try
    {
        Session session = getBROWSER_11_Session();
        if (session == null)
        {
            fail("ATOMPUB 1.1 session cannot be null");
        }
        testFolder = createFolder(session, "testRemoveAllPermissions_BROWSER_11");
        List<Ace> acl = create2TestACLs(session);

        // adding new ACE
        testFolder.addAcl(acl, AclPropagation.PROPAGATE);

        Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false);
        int oldSize = allacl.getAces().size();

        // Removing ALL ACEs

        Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE);
        int newsize = newAcl.getAces().size();

        System.out.println("Old ace size -->" + oldSize);
        System.out.println("New ace size --> " + newsize);

        assertTrue(newsize == oldSize - acl.size());
    }
    catch (Exception ex)
    {
        fail(ex.getMessage());
    }
    finally
    {
        if (testFolder != null)
        {
            testFolder.delete();
        }
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:44,代码来源:TestRemovePermissions.java


示例15: createDocument

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Override
public ObjectId createDocument(Map<String, ?> properties, ObjectId folderId, ContentStream contentStream, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
    return createDocument(properties, folderId, contentStream, versioningState);
}
 
开发者ID:sismics,项目名称:play-cmis,代码行数:5,代码来源:InMemorySessionImpl.java


示例16: createDocumentFromSource

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Override
public ObjectId createDocumentFromSource(ObjectId source, Map<String, ?> properties, ObjectId folderId, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
    throw new RuntimeException("not implemented");
}
 
开发者ID:sismics,项目名称:play-cmis,代码行数:5,代码来源:InMemorySessionImpl.java


示例17: createFolder

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Override
public ObjectId createFolder(Map<String, ?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
    throw new RuntimeException("not implemented");
}
 
开发者ID:sismics,项目名称:play-cmis,代码行数:5,代码来源:InMemorySessionImpl.java


示例18: createPolicy

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Override
public ObjectId createPolicy(Map<String, ?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
    throw new RuntimeException("not implemented");
}
 
开发者ID:sismics,项目名称:play-cmis,代码行数:5,代码来源:InMemorySessionImpl.java


示例19: createRelationship

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Override
public ObjectId createRelationship(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
    throw new RuntimeException("not implemented");
}
 
开发者ID:sismics,项目名称:play-cmis,代码行数:5,代码来源:InMemorySessionImpl.java


示例20: applyAcl

import org.apache.chemistry.opencmis.commons.data.Ace; //导入依赖的package包/类
@Override
public Acl applyAcl(ObjectId objectId, List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation) {
    throw new RuntimeException("not implemented");
}
 
开发者ID:sismics,项目名称:play-cmis,代码行数:5,代码来源:InMemorySessionImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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