本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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());
}
示例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()));
}
}
}
}
}
示例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;
}
}
示例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;
}
示例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();
}
}
示例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");
}
}
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}