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


Java SimplePermissionReference类代码示例

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


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

示例1: ConfigAttributeDefintion

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
ConfigAttributeDefintion(ConfigAttribute attr)
{

    StringTokenizer st = new StringTokenizer(attr.getAttribute(), ".", false);
    if (st.countTokens() != 3)
    {
        throw new ACLEntryVoterException("There must be three . separated tokens in each config attribute");
    }
    typeString = st.nextToken();
    String qNameString = st.nextToken();
    String permissionString = st.nextToken();

    if (!(typeString.equals(AFTER_ACL_NODE) || typeString.equals(AFTER_ACL_PARENT)))
    {
        throw new ACLEntryVoterException("Invalid type: must be ACL_NODE or ACL_PARENT");
    }

    QName qName = QName.createQName(qNameString, nspr);

    required = SimplePermissionReference.getPermissionReference(qName, permissionString);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:ACLEntryAfterInvocationProvider.java

示例2: getAllPermissions

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
private Set<PermissionReference> getAllPermissions()
{
    HashSet<PermissionReference> permissions = new HashSet<PermissionReference>(256, 1.0f);
    for (PermissionSet ps : permissionSets.values())
    {
        for (PermissionGroup pg : ps.getPermissionGroups())
        {
            permissions.add(SimplePermissionReference.getPermissionReference(pg.getQName(), pg.getName()));
        }
        for (Permission p : ps.getPermissions())
        {
            permissions.add(SimplePermissionReference.getPermissionReference(p.getQName(), p.getName()));
        }
    }
    return permissions;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:PermissionModel.java

示例3: renamePermission

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
/**
 * Helper method to rename (move) a permission.  This involves checking for the existence of the
 * new permission and then moving all the entries to point to the new permission.
 * 
 * @param oldTypeQName the old permission type
 * @param oldName the old permission name
 * @param newTypeQName the new permission type
 * @param newName the new permission name
 * @return Returns the number of permission entries modified
 */
protected int renamePermission(QName oldTypeQName, String oldName, QName newTypeQName, String newName)
{
    if (oldTypeQName.equals(newTypeQName) && oldName.equals(newName))
    {
        throw new IllegalArgumentException("Cannot move permission to itself: " + oldTypeQName + "-" + oldName);
    }
    
    SimplePermissionReference oldPermRef = SimplePermissionReference.getPermissionReference(oldTypeQName, oldName);
    Permission permission = aclCrudDAO.getPermission(oldPermRef);
    if (permission == null)
    {
        // create the permission
        SimplePermissionReference newPermRef = SimplePermissionReference.getPermissionReference(newTypeQName, newName);
        aclCrudDAO.createPermission(newPermRef);
    }
    else
    {
        // rename the permission
        aclCrudDAO.renamePermission(oldTypeQName, oldName, newTypeQName, newName);
    }
    // done
    return 1;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:AbstractPermissionChangePatch.java

示例4: testRequiredPermissions

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public void testRequiredPermissions()
{
    Set<PermissionReference> required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base",
            namespacePrefixResolver), "Read"), QName.createQName("sys", "base", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(3, required.size());

    required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver),
            "ReadContent"), QName.createQName("sys", "base", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(1, required.size());

    required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver),
            "_ReadContent"), QName.createQName("sys", "base", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(0, required.size());

    required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject", namespacePrefixResolver),
            "Coordinator"), QName.createQName("cm", "cmobject", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(17, required.size());

    required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver),
            "FullControl"), QName.createQName("sys", "base", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(17, required.size());

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:PermissionModelTest.java

示例5: mergePermissions

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
/**
 * Support to merge permissions together. Respects extended permissions.
 *
 * @param target Set<PermissionReference>
 * @param type QName
 * @param exposedOnly boolean
 * @param typeRequired boolean
 */
private void mergePermissions(Set<PermissionReference> target, QName type, boolean exposedOnly, boolean typeRequired)
{
    PermissionSet permissionSet = permissionSets.get(type);
    if (permissionSet != null)
    {
        for (PermissionGroup pg : permissionSet.getPermissionGroups())
        {
            if (!exposedOnly || permissionSet.exposeAll() || pg.isExposed())
            {
                if (!pg.isExtends())
                {
                    if (pg.isTypeRequired() == typeRequired)
                    {
                        target.add(SimplePermissionReference.getPermissionReference(pg.getQName(), pg.getName()));
                    }
                }
                else if (exposedOnly)
                {
                    if (pg.isTypeRequired() == typeRequired)
                    {
                        PermissionReference base = getBasePermissionGroup(pg);
                        target.add(SimplePermissionReference.getPermissionReference(base.getQName(), base.getName()));
                    }
                }
            }
        }
        for (Permission p : permissionSet.getPermissions())
        {
            if (!exposedOnly || permissionSet.exposeAll() || p.isExposed())
            {
                if (p.isTypeRequired() == typeRequired)
                {
                    target.add(SimplePermissionReference.getPermissionReference(p.getQName(), p.getName()));
                }
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:47,代码来源:PermissionModel.java

示例6: getBasePermissionGroupOrNullImpl

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
/**
 * Query the model for a base permission group Uses the Data Dictionary to reolve inheritance
 * 
 * @param pg PermissionGroup
 * @return the permission group
 */
private PermissionGroup getBasePermissionGroupOrNullImpl(PermissionGroup pg)
{
    if (pg == null)
    {
        return null;
    }
    if (pg.isExtends())
    {
        if (pg.getTypeQName() != null)
        {
            return getPermissionGroup(SimplePermissionReference.getPermissionReference(pg.getTypeQName(), pg.getName()));
        }
        else
        {
            ClassDefinition classDefinition = dictionaryService.getClass(pg.getQName());
            QName parent;
            if (classDefinition != null) {
                while ((parent = classDefinition.getParentName()) != null)
                {
                    classDefinition = dictionaryService.getClass(parent);
                    PermissionGroup attempt = getPermissionGroupOrNull(SimplePermissionReference.getPermissionReference(parent, pg.getName()));
                    if ((attempt != null) && (!attempt.isExtends()))
                    {
                        return attempt;
                    }
                }
            }
            return null;
        }
    }
    else
    {
        return pg;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:PermissionModel.java

示例7: getImmediateGranteePermissions

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
private Set<PermissionReference> getImmediateGranteePermissions(PermissionReference permissionReference)
{
    // Cache the results

    Set<PermissionReference> internal = getImmediateGranteePermissionsImpl(permissionReference);
    Set<PermissionReference> grantees = new HashSet<PermissionReference>();
    for (PermissionReference grantee : internal)
    {
        grantees.add(SimplePermissionReference.getPermissionReference(grantee.getQName(), grantee.getName()));
    }
    grantees = Collections.unmodifiableSet(grantees);

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

示例8: getAllExposedPermissions

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public Set<PermissionReference> getAllExposedPermissions()
{        
    Set<PermissionReference> permissions = new HashSet<PermissionReference>(256);
    mutableState.lock.readLock().lock();
    try
    {
        for (PermissionSet ps : mutableState.permissionSets.values())
        {
            for (PermissionGroup pg : ps.getPermissionGroups())
            {
                if (pg.isExposed())
                {
                    permissions.add(SimplePermissionReference.getPermissionReference(pg.getQName(), pg.getName()));
                }
            }
            for (Permission p : ps.getPermissions())
            {
                if (p.isExposed())
                {
                    permissions.add(SimplePermissionReference.getPermissionReference(p.getQName(), p.getName()));
                }
            }
        }
        return permissions;
    }
    finally
    {
        mutableState.lock.readLock().unlock();
    }        
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:PermissionModel.java

示例9: renamePermission

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public void renamePermission(QName oldTypeQName, String oldName, QName newTypeQName, String newName)
{
    ParameterCheck.mandatory("oldTypeQName", oldTypeQName);
    ParameterCheck.mandatory("oldName", oldName);
    ParameterCheck.mandatory("newTypeQName", newTypeQName);
    ParameterCheck.mandatory("newName", newName);
    
    if (oldTypeQName.equals(newTypeQName) && oldName.equals(newName))
    {
        throw new IllegalArgumentException("Cannot move permission to itself: " + oldTypeQName + "-" + oldName);
    }
    
    SimplePermissionReference oldPermRef = SimplePermissionReference.getPermissionReference(oldTypeQName, oldName);
    PermissionEntity permission = getPermissionForUpdate(oldPermRef);
    if (permission != null)
    {
        Long newTypeQNameId = qnameDAO.getOrCreateQName(newTypeQName).getFirst();
        permission.setTypeQNameId(newTypeQNameId);
        permission.setName(newName);
        
        int updated = permissionEntityCache.updateValue(permission.getId(), permission);
        if (updated < 1)
        {
            aclEntityCache.removeByKey(permission.getId());
            throw new ConcurrencyFailureException("PermissionEntity with ID (" + permission.getId() + ") no longer exists or has been updated concurrently");
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:AbstractAclCrudDAOImpl.java

示例10: testIncludePermissionGroups

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public void testIncludePermissionGroups()
{
    Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject",
            namespacePrefixResolver), "Consumer"));

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

示例11: testIncludePermissionGroups2

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public void testIncludePermissionGroups2()
{
    Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject",
            namespacePrefixResolver), "Contributor"));

    assertEquals(16, grantees.size());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:PermissionModelTest.java

示例12: testIncludePermissionGroups3

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public void testIncludePermissionGroups3()
{
    Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject",
            namespacePrefixResolver), "Editor"));

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

示例13: testIncludePermissionGroups4

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public void testIncludePermissionGroups4()
{
    Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject",
            namespacePrefixResolver), "Collaborator"));

    assertEquals(26, grantees.size());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:PermissionModelTest.java

示例14: testIncludePermissionGroups5

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public void testIncludePermissionGroups5()
{
    Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject",
            namespacePrefixResolver), "Coordinator"));

    assertEquals(69, grantees.size());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:PermissionModelTest.java

示例15: testIncludePermissionGroups6

import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; //导入依赖的package包/类
public void testIncludePermissionGroups6()
{
    Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject",
            namespacePrefixResolver), "RecordAdministrator"));

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


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