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


Java Acl类代码示例

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


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

示例1: createPolicy

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
@Override
public String createPolicy(
        String repositoryId, Properties properties, String folderId, List<String> policies,
        Acl addAces, Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get the parent folder
    getOrCreateFolderInfo(folderId, "Parent Folder");

    String objectTypeId = connector.getObjectTypeIdProperty(properties);
    connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_POLICY);

    // we should never get here - policies are not creatable!
    throw new CmisRuntimeException("Polcies cannot be created!");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:AlfrescoCmisServiceImpl.java

示例2: applyAcl

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
@Override
public Acl applyAcl(
        String repositoryId, String objectId, final Acl addAces, final Acl removeAces,
        AclPropagation aclPropagation, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // We are spec compliant if we just let it through and the tck will not fail

    CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");

    // relationships don't have ACLs
    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        throw new CmisConstraintException("Relationships are not ACL controllable!");
    }

    final NodeRef nodeRef = info.getCurrentNodeNodeRef();
    final TypeDefinitionWrapper type = info.getType();

    connector.applyACL(nodeRef, type, addAces, removeAces);

    return connector.getACL(nodeRef, false);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:AlfrescoCmisServiceImpl.java

示例3: getAcl

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");

    // relationships don't have ACLs
    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        return new AccessControlListImpl(Collections.EMPTY_LIST);
    }

    // get the ACL
    return connector.getACL(info.getCurrentNodeNodeRef(), onlyBasicPermissions);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AlfrescoCmisServiceImpl.java

示例4: createDocument

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
/**
 * Overridden to capture content upload for publishing to analytics service.
 */
@Override
public String createDocument(String repositoryId, Properties properties, String folderId,
            ContentStream contentStream, VersioningState versioningState,
            List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension)
{
    String newId = super.createDocument(
                repositoryId,
                properties,
                folderId,
                contentStream,
                versioningState,
                policies,
                addAces,
                removeAces,
                extension);
    return newId;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:21,代码来源:PublicApiAlfrescoCmisService.java

示例5: getPermissionsImpl

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的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

示例6: excludeInheritedAces

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的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

示例7: applyACL

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的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

示例8: createFolder

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
@Override
public String createFolder(String repositoryId, final Properties properties, String folderId,
        final List<String> policies, final Acl addAces, final Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get the parent folder node ref
    final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Folder");

    // get name and type
    final String name = connector.getNameProperty(properties, null);
    final String objectTypeId = connector.getObjectTypeIdProperty(properties);
    final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_FOLDER);

    connector.checkChildObjectType(parentInfo, type.getTypeId());

    // run transaction
    FileInfo fileInfo = connector.getFileFolderService().create(
            parentInfo.getNodeRef(), name, type.getAlfrescoClass());
    NodeRef nodeRef = fileInfo.getNodeRef();

    connector.setProperties(nodeRef, type, properties, new String[] { PropertyIds.NAME, PropertyIds.OBJECT_TYPE_ID });
    connector.applyPolicies(nodeRef, type, policies);
    connector.applyACL(nodeRef, type, addAces, removeAces);
    
    connector.getActivityPoster().postFileFolderAdded(nodeRef);

    String objectId = connector.createObjectId(nodeRef);
    return objectId;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:AlfrescoCmisServiceImpl.java

示例9: excludeInheritedAces

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的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

示例10: getAcl

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
/**
 * CMIS getACL.
 */
public Acl getAcl(CallContext context, String objectId) {
    checkUser(context, false);

    // get the file or folder
    File file = getFile(objectId);
    if (!file.exists()) {
        throw new CmisObjectNotFoundException("Object not found!");
    }

    return compileAcl(file);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:15,代码来源:FileBridgeRepository.java

示例11: compileAcl

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的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

示例12: createDocumentFromSource

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
@Override
public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
        String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
        ExtensionsData extension) {
    return getRepository().createDocumentFromSource(getCallContext(), sourceId, properties, folderId,
            versioningState);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:8,代码来源:FileBridgeCmisService.java

示例13: getAcl

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
/**
 * CMIS getACL.
 */
public Acl getAcl(CallContext context, String objectId) {
	checkUser(context, false);

	// get the file or folder
	File file = getFile(objectId);
	if (!file.exists()) {
		throw new CmisObjectNotFoundException("Object not found!");
	}

	return compileAcl(file);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:15,代码来源:FileBridgeRepository.java

示例14: compileAcl

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的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

示例15: createDocument

import org.apache.chemistry.opencmis.commons.data.Acl; //导入依赖的package包/类
@Override
public String createDocument(String repositoryId, Properties properties,
		String folderId, ContentStream contentStream,
		VersioningState versioningState, List<String> policies,
		Acl addAces, Acl removeAces, ExtensionsData extension) {
	return getRepository().createDocument(getCallContext(), properties,
			folderId, contentStream, versioningState);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:9,代码来源:FileBridgeCmisService.java


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