mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10631 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,8 +39,8 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* Old permissions dao component impl
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public class PermissionsDaoComponentImpl extends AbstractPermissionsDaoComponentImpl
|
||||
{
|
||||
@@ -144,32 +144,51 @@ public class PermissionsDaoComponentImpl extends AbstractPermissionsDaoComponent
|
||||
}
|
||||
if (acl != null)
|
||||
{
|
||||
if (acl.getInheritsFrom() != null)
|
||||
switch (acl.getAclType())
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
Long deleted = acl.getId();
|
||||
Long inheritsFrom = acl.getInheritsFrom();
|
||||
getACLDAO(nodeRef).setAccessControlList(nodeRef, aclDaoComponent.getDbAccessControlList(inheritsFrom));
|
||||
List<AclChange> changes = new ArrayList<AclChange>();
|
||||
changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, inheritsFrom));
|
||||
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
||||
aclDaoComponent.deleteAccessControlList(acl.getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: could just cear out existing
|
||||
@SuppressWarnings("unused")
|
||||
Long deleted = acl.getId();
|
||||
SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
|
||||
properties.setAclType(ACLType.DEFINING);
|
||||
properties.setInherits(Boolean.FALSE);
|
||||
// Accept default versioning
|
||||
Long id = aclDaoComponent.createAccessControlList(properties);
|
||||
getACLDAO(nodeRef).setAccessControlList(nodeRef, aclDaoComponent.getDbAccessControlList(id));
|
||||
List<AclChange> changes = new ArrayList<AclChange>();
|
||||
changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, aclDaoComponent.getInheritedAccessControlList(id)));
|
||||
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
||||
aclDaoComponent.deleteAccessControlList(acl.getId());
|
||||
case OLD:
|
||||
throw new IllegalStateException("Can not mix old and new style permissions");
|
||||
case DEFINING:
|
||||
|
||||
if (acl.getInheritsFrom() != null)
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
Long deleted = acl.getId();
|
||||
Long inheritsFrom = acl.getInheritsFrom();
|
||||
getACLDAO(nodeRef).setAccessControlList(nodeRef, aclDaoComponent.getDbAccessControlList(inheritsFrom));
|
||||
List<AclChange> changes = new ArrayList<AclChange>();
|
||||
changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, inheritsFrom));
|
||||
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
||||
aclDaoComponent.deleteAccessControlList(acl.getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: could just cear out existing
|
||||
@SuppressWarnings("unused")
|
||||
Long deleted = acl.getId();
|
||||
SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
|
||||
properties.setAclType(ACLType.DEFINING);
|
||||
properties.setInherits(Boolean.FALSE);
|
||||
// Accept default versioning
|
||||
Long id = aclDaoComponent.createAccessControlList(properties);
|
||||
getACLDAO(nodeRef).setAccessControlList(nodeRef, aclDaoComponent.getDbAccessControlList(id));
|
||||
List<AclChange> changes = new ArrayList<AclChange>();
|
||||
changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, aclDaoComponent.getInheritedAccessControlList(id)));
|
||||
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
||||
aclDaoComponent.deleteAccessControlList(acl.getId());
|
||||
}
|
||||
break;
|
||||
case FIXED:
|
||||
throw new IllegalStateException("Delete not supported for fixed permissions");
|
||||
case GLOBAL:
|
||||
throw new IllegalStateException("Delete not supported for global permissions");
|
||||
case SHARED:
|
||||
// nothing to do
|
||||
return;
|
||||
case LAYERED:
|
||||
throw new IllegalStateException("Layering is not supported for DM permissions");
|
||||
default:
|
||||
throw new IllegalStateException("Unknown type " + acl.getAclType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user