Search in sources :

Example 11 with AccessControlListProperties

use of org.alfresco.repo.security.permissions.AccessControlListProperties in project alfresco-repository by Alfresco.

the class AclDaoComponentTest method testCreateDefining.

public void testCreateDefining() {
    SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
    properties.setAclType(ACLType.DEFINING);
    properties.setVersioned(true);
    AccessControlListProperties aclProps = aclDaoComponent.createAccessControlList(properties);
    assertEquals(aclProps.getAclType(), ACLType.DEFINING);
    assertEquals(aclProps.getAclVersion(), Long.valueOf(1l));
    assertEquals(aclProps.getInherits(), Boolean.TRUE);
    assertEquals(aclDaoComponent.getAccessControlListProperties(aclProps.getId()), aclProps);
}
Also used : AccessControlListProperties(org.alfresco.repo.security.permissions.AccessControlListProperties) SimpleAccessControlListProperties(org.alfresco.repo.security.permissions.SimpleAccessControlListProperties) SimpleAccessControlListProperties(org.alfresco.repo.security.permissions.SimpleAccessControlListProperties)

Example 12 with AccessControlListProperties

use of org.alfresco.repo.security.permissions.AccessControlListProperties in project alfresco-repository by Alfresco.

the class AclDaoComponentTest method testGlobal.

public void testGlobal() {
    SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
    properties.setAclType(ACLType.GLOBAL);
    properties.setVersioned(false);
    AccessControlListProperties aclProps = aclDaoComponent.createAccessControlList(properties);
    Long id = aclProps.getId();
    assertEquals(aclProps.getAclType(), ACLType.GLOBAL);
    assertEquals(aclProps.getAclVersion(), Long.valueOf(1l));
    assertEquals(aclProps.getInherits(), Boolean.TRUE);
    assertEquals(aclDaoComponent.getAccessControlListProperties(aclProps.getId()), aclProps);
    assertEquals(aclDaoComponent.getInheritedAccessControlList(id), id);
}
Also used : AccessControlListProperties(org.alfresco.repo.security.permissions.AccessControlListProperties) SimpleAccessControlListProperties(org.alfresco.repo.security.permissions.SimpleAccessControlListProperties) SimpleAccessControlListProperties(org.alfresco.repo.security.permissions.SimpleAccessControlListProperties)

Example 13 with AccessControlListProperties

use of org.alfresco.repo.security.permissions.AccessControlListProperties in project alfresco-repository by Alfresco.

the class AclDaoComponentTest method testCreateOld.

public void testCreateOld() {
    SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
    properties.setAclType(ACLType.OLD);
    properties.setVersioned(false);
    AccessControlListProperties aclProps = aclDaoComponent.createAccessControlList(properties);
    assertEquals(aclProps.getAclType(), ACLType.OLD);
    assertEquals(aclProps.getAclVersion(), Long.valueOf(1l));
    assertEquals(aclProps.getInherits(), Boolean.TRUE);
    assertEquals(aclDaoComponent.getAccessControlListProperties(aclProps.getId()), aclProps);
    assertEquals(aclDaoComponent.getInheritedAccessControlList(aclProps.getId()), null);
}
Also used : AccessControlListProperties(org.alfresco.repo.security.permissions.AccessControlListProperties) SimpleAccessControlListProperties(org.alfresco.repo.security.permissions.SimpleAccessControlListProperties) SimpleAccessControlListProperties(org.alfresco.repo.security.permissions.SimpleAccessControlListProperties)

Example 14 with AccessControlListProperties

use of org.alfresco.repo.security.permissions.AccessControlListProperties in project alfresco-repository by Alfresco.

the class AclDaoComponentTest method testCreateShared.

public void testCreateShared() {
    SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
    properties.setAclType(ACLType.DEFINING);
    properties.setVersioned(true);
    AccessControlListProperties aclProps = aclDaoComponent.createAccessControlList(properties);
    assertEquals(aclProps.getAclType(), ACLType.DEFINING);
    assertEquals(aclProps.getAclVersion(), Long.valueOf(1l));
    assertEquals(aclProps.getInherits(), Boolean.TRUE);
    assertEquals(aclDaoComponent.getAccessControlListProperties(aclProps.getId()), aclProps);
    Long shared = aclDaoComponent.getInheritedAccessControlList(aclProps.getId());
    AccessControlListProperties sharedProps = aclDaoComponent.getAccessControlListProperties(shared);
    assertEquals(sharedProps.getAclType(), ACLType.SHARED);
    assertEquals(sharedProps.getAclVersion(), Long.valueOf(1l));
    assertEquals(sharedProps.getInherits(), Boolean.TRUE);
    assertEquals(aclDaoComponent.getInheritedAccessControlList(aclProps.getId()), shared);
}
Also used : AccessControlListProperties(org.alfresco.repo.security.permissions.AccessControlListProperties) SimpleAccessControlListProperties(org.alfresco.repo.security.permissions.SimpleAccessControlListProperties) SimpleAccessControlListProperties(org.alfresco.repo.security.permissions.SimpleAccessControlListProperties)

Aggregations

AccessControlListProperties (org.alfresco.repo.security.permissions.AccessControlListProperties)14 SimpleAccessControlListProperties (org.alfresco.repo.security.permissions.SimpleAccessControlListProperties)11 SimpleAccessControlEntry (org.alfresco.repo.security.permissions.SimpleAccessControlEntry)4 AccessControlList (org.alfresco.repo.security.permissions.AccessControlList)3 NodeRef (org.alfresco.service.cmr.repository.NodeRef)3 ArrayList (java.util.ArrayList)2 QName (org.alfresco.service.namespace.QName)2 Serializable (java.io.Serializable)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 Authentication (net.sf.acegisecurity.Authentication)1 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)1 NodeIdAndAclId (org.alfresco.repo.domain.node.NodeIdAndAclId)1 AccessControlEntry (org.alfresco.repo.security.permissions.AccessControlEntry)1 PermissionReference (org.alfresco.repo.security.permissions.PermissionReference)1 SimpleAccessControlList (org.alfresco.repo.security.permissions.SimpleAccessControlList)1 SimplePermissionReference (org.alfresco.repo.security.permissions.impl.SimplePermissionReference)1 Acl (org.alfresco.repo.solr.Acl)1