protected CreationReport getMutableAccessControlList(NodeRef nodeRef) { Acl acl = getACLDAO(nodeRef).getAccessControlList(nodeRef); if (acl == null) { return createAccessControlList(nodeRef, INHERIT_PERMISSIONS_DEFAULT, null); } else { switch (acl.getAclType()) { case FIXED: case GLOBAL: case SHARED: case LAYERED: // We can not set an ACL on node that has one of these types so we need to make a new one .... return createAccessControlList(nodeRef, INHERIT_PERMISSIONS_DEFAULT, acl); case DEFINING: case OLD: default: // Force a copy on write if one is required getACLDAO(nodeRef).forceCopy(nodeRef); acl = getACLDAO(nodeRef).getAccessControlList(nodeRef); return new CreationReport(acl, Collections.<AclChange> emptyList()); } } }
private Acl getMutableAccessControlList(StoreRef storeRef) { Acl acl = getACLDAO(storeRef).getAccessControlList(storeRef); if(acl == null) { SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties(); properties.setAclType(ACLType.DEFINING); properties.setInherits(false); properties.setVersioned(false); acl = aclDaoComponent.createAccessControlList(properties); getACLDAO(storeRef).setAccessControlList(storeRef, acl); } return acl; }
Long inheritsFrom = getACLDAO(nodeRef).getInheritedAcl(nodeRef); if(inheritsFrom != null) getACLDAO(nodeRef).setAccessControlList(nodeRef, aclDaoComponent.getAcl(inheritsFrom)); List<AclChange> changes = new ArrayList<AclChange>(); changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, inheritsFrom, aclDaoComponent.getInheritedAccessControlList(acl.getId()))); getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes); aclDaoComponent.deleteAccessControlList(acl.getId());
/** * @param nodeRef NodeRef * @param acl Acl */ private void replaceWithCleanDefiningAcl(NodeRef nodeRef, Acl acl) { // TODO: could just clear out existing SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties(); properties = new SimpleAccessControlListProperties(); properties.setAclType(ACLType.DEFINING); properties.setInherits(Boolean.FALSE); properties.setVersioned(false); Acl newAcl = aclDaoComponent.createAccessControlList(properties); long id = newAcl.getId(); getACLDAO(nodeRef).setAccessControlList(nodeRef, newAcl); List<AclChange> changes = new ArrayList<AclChange>(); changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, id, acl.getInheritedAcl())); getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes); aclDaoComponent.deleteAccessControlList(acl.getId()); } }
acl = aclDAO.getAccessControlList(nodeRef); if (acl == null) pattern.setPosition(Integer.valueOf(0)); List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern); getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes); break;
private Acl getAccessControlList(StoreRef storeRef) { return getACLDAO(storeRef).getAccessControlList(storeRef); }
public void setInheritParentPermissions(NodeRef nodeRef, boolean inheritParentPermissions) { Acl acl = getAccessControlList(nodeRef); if ((acl == null) && (inheritParentPermissions == INHERIT_PERMISSIONS_DEFAULT)) { return; } if ((acl != null) && (acl.getInherits() == inheritParentPermissions)) { return; } CreationReport report = getMutableAccessControlList(nodeRef); List<AclChange> changes; if (!inheritParentPermissions) { changes = aclDaoComponent.disableInheritance(report.getCreated().getId(), false); } else { Long parentAcl = getACLDAO(nodeRef).getInheritedAcl(nodeRef); changes = aclDaoComponent.enableInheritance(report.getCreated().getId(), parentAcl); } List<AclChange> all = new ArrayList<AclChange>(changes.size() + report.getChanges().size()); all.addAll(report.getChanges()); all.addAll(changes); getACLDAO(nodeRef).updateChangedAcls(nodeRef, all); }
changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, id, null)); getACLDAO(nodeRef).setAccessControlList(nodeRef, acl); return new CreationReport(acl, changes); changes.addAll(aclDaoComponent.mergeInheritedAccessControlList(existing.getId(), id)); changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, id, aclDaoComponent.getInheritedAccessControlList(existing.getId()))); getACLDAO(nodeRef).setAccessControlList(nodeRef, acl); return new CreationReport(acl, changes); case LAYERED:
public void setPermission(NodeRef nodeRef, String authority, PermissionReference permission, boolean allow) { CreationReport report = null; try { report = getMutableAccessControlList(nodeRef); } catch (InvalidNodeRefException e) { return; } if (report.getCreated() != null) { SimpleAccessControlEntry entry = new SimpleAccessControlEntry(); entry.setAuthority(authority); entry.setPermission(permission); entry.setAccessStatus(allow ? AccessStatus.ALLOWED : AccessStatus.DENIED); entry.setAceType(ACEType.ALL); entry.setPosition(Integer.valueOf(0)); List<AclChange> changes = aclDaoComponent.setAccessControlEntry(report.getCreated().getId(), entry); List<AclChange> all = new ArrayList<AclChange>(changes.size() + report.getChanges().size()); all.addAll(report.getChanges()); all.addAll(changes); getACLDAO(nodeRef).updateChangedAcls(nodeRef, all); } }
public void deletePermissions(StoreRef storeRef) { getACLDAO(storeRef).setAccessControlList(storeRef, null); }
accessControlListDAO.setInheritanceForChildren(nodeRef, inheritFrom, sharedAclToReplace, true);
accessControlListDAO.updateInheritance(newChildNodeId, oldParentAclId, newParentAclId);
Long inheritsFrom = getACLDAO(nodeRef).getInheritedAcl(nodeRef); if(inheritsFrom != null) getACLDAO(nodeRef).setAccessControlList(nodeRef, aclDaoComponent.getAcl(inheritsFrom)); List<AclChange> changes = new ArrayList<AclChange>(); changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, inheritsFrom, aclDaoComponent.getInheritedAccessControlList(acl.getId()))); getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes); aclDaoComponent.deleteAccessControlList(acl.getId());
/** * @param nodeRef NodeRef * @param acl Acl */ private void replaceWithCleanDefiningAcl(NodeRef nodeRef, Acl acl) { // TODO: could just clear out existing SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties(); properties = new SimpleAccessControlListProperties(); properties.setAclType(ACLType.DEFINING); properties.setInherits(Boolean.FALSE); properties.setVersioned(false); Acl newAcl = aclDaoComponent.createAccessControlList(properties); long id = newAcl.getId(); getACLDAO(nodeRef).setAccessControlList(nodeRef, newAcl); List<AclChange> changes = new ArrayList<AclChange>(); changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, id, acl.getInheritedAcl())); getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes); aclDaoComponent.deleteAccessControlList(acl.getId()); } }
acl = aclDAO.getAccessControlList(nodeRef); if (acl == null) pattern.setPosition(Integer.valueOf(0)); List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern); getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes); break;
private Acl getAccessControlList(StoreRef storeRef) { return getACLDAO(storeRef).getAccessControlList(storeRef); }
public void setInheritParentPermissions(NodeRef nodeRef, boolean inheritParentPermissions) { Acl acl = getAccessControlList(nodeRef); if ((acl == null) && (inheritParentPermissions == INHERIT_PERMISSIONS_DEFAULT)) { return; } if ((acl != null) && (acl.getInherits() == inheritParentPermissions)) { return; } CreationReport report = getMutableAccessControlList(nodeRef); List<AclChange> changes; if (!inheritParentPermissions) { changes = aclDaoComponent.disableInheritance(report.getCreated().getId(), false); } else { Long parentAcl = getACLDAO(nodeRef).getInheritedAcl(nodeRef); changes = aclDaoComponent.enableInheritance(report.getCreated().getId(), parentAcl); } List<AclChange> all = new ArrayList<AclChange>(changes.size() + report.getChanges().size()); all.addAll(report.getChanges()); all.addAll(changes); getACLDAO(nodeRef).updateChangedAcls(nodeRef, all); }
changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, id, null)); getACLDAO(nodeRef).setAccessControlList(nodeRef, acl); return new CreationReport(acl, changes); changes.addAll(aclDaoComponent.mergeInheritedAccessControlList(existing.getId(), id)); changes.addAll(getACLDAO(nodeRef).setInheritanceForChildren(nodeRef, id, aclDaoComponent.getInheritedAccessControlList(existing.getId()))); getACLDAO(nodeRef).setAccessControlList(nodeRef, acl); return new CreationReport(acl, changes); case LAYERED:
public void setPermission(NodeRef nodeRef, String authority, PermissionReference permission, boolean allow) { CreationReport report = null; try { report = getMutableAccessControlList(nodeRef); } catch (InvalidNodeRefException e) { return; } if (report.getCreated() != null) { SimpleAccessControlEntry entry = new SimpleAccessControlEntry(); entry.setAuthority(authority); entry.setPermission(permission); entry.setAccessStatus(allow ? AccessStatus.ALLOWED : AccessStatus.DENIED); entry.setAceType(ACEType.ALL); entry.setPosition(Integer.valueOf(0)); List<AclChange> changes = aclDaoComponent.setAccessControlEntry(report.getCreated().getId(), entry); List<AclChange> all = new ArrayList<AclChange>(changes.size() + report.getChanges().size()); all.addAll(report.getChanges()); all.addAll(changes); getACLDAO(nodeRef).updateChangedAcls(nodeRef, all); } }
public void deletePermissions(StoreRef storeRef) { getACLDAO(storeRef).setAccessControlList(storeRef, null); }