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()); } } }
public NodePermissionEntry getPermissions(StoreRef storeRef) { // Create the object if it is not found. // Null objects are not cached in hibernate // If the object does not exist it will repeatedly query to check its // non existence. NodePermissionEntry npe = null; Acl acl = null; try { acl = getAccessControlList(storeRef); } catch (InvalidNodeRefException e) { // Do nothing. } if (acl == null) { // there isn't an access control list for the node - spoof a null one SimpleNodePermissionEntry snpe = new SimpleNodePermissionEntry(null, true, Collections.<SimplePermissionEntry> emptyList()); npe = snpe; } else { npe = createSimpleNodePermissionEntry(storeRef); } return npe; }
public void deletePermissions(StoreRef storeRef, String authority) { Acl acl = getAccessControlList(storeRef); if(acl == null) { return; } acl = getMutableAccessControlList(storeRef); SimpleAccessControlEntry pattern = new SimpleAccessControlEntry(); pattern.setAuthority(authority); pattern.setPosition(Integer.valueOf(0)); aclDaoComponent.deleteAccessControlEntries(acl.getId(), pattern); }
public void setPermission(NodePermissionEntry nodePermissionEntry) { NodeRef nodeRef = nodePermissionEntry.getNodeRef(); // Get the access control list // Note the logic here requires to know whether it was created or not Acl existing = getAccessControlList(nodeRef); if (existing != null) { deletePermissions(nodeRef); } // create the access control list existing = getAccessControlList(nodeRef); CreationReport report = createAccessControlList(nodeRef, nodePermissionEntry.inheritPermissions(), existing); // add all entries for (PermissionEntry pe : nodePermissionEntry.getPermissionEntries()) { SimpleAccessControlEntry entry = new SimpleAccessControlEntry(); entry.setAuthority(pe.getAuthority()); entry.setPermission(pe.getPermissionReference()); entry.setAccessStatus(pe.isAllowed() ? 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 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 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); }
private Acl getAccessControlList(StoreRef storeRef) { return getACLDAO(storeRef).getAccessControlList(storeRef); }
public void setPermission(StoreRef storeRef, String authority, PermissionReference permission, boolean allow) { Acl acl = getMutableAccessControlList(storeRef); 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)); aclDaoComponent.setAccessControlEntry(acl.getId(), entry); }
public void setPermission(PermissionEntry permissionEntry) { setPermission(permissionEntry.getNodeRef(), permissionEntry.getAuthority(), permissionEntry.getPermissionReference(), permissionEntry.isAllowed()); }
public boolean getInheritParentPermissions(NodeRef nodeRef) { Acl acl = null; try { acl = getAccessControlList(nodeRef); } catch (InvalidNodeRefException e) { return INHERIT_PERMISSIONS_DEFAULT; } if (acl == null) { return INHERIT_PERMISSIONS_DEFAULT; } else { return aclDaoComponent.getAccessControlListProperties(acl.getId()).getInherits(); } }
public void setPermission(NodePermissionEntry nodePermissionEntry) { NodeRef nodeRef = nodePermissionEntry.getNodeRef(); // Get the access control list // Note the logic here requires to know whether it was created or not Acl existing = getAccessControlList(nodeRef); if (existing != null) { deletePermissions(nodeRef); } // create the access control list existing = getAccessControlList(nodeRef); CreationReport report = createAccessControlList(nodeRef, nodePermissionEntry.inheritPermissions(), existing); // add all entries for (PermissionEntry pe : nodePermissionEntry.getPermissionEntries()) { SimpleAccessControlEntry entry = new SimpleAccessControlEntry(); entry.setAuthority(pe.getAuthority()); entry.setPermission(pe.getPermissionReference()); entry.setAccessStatus(pe.isAllowed() ? 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 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 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); }
public void deletePermissions(StoreRef storeRef) { getACLDAO(storeRef).setAccessControlList(storeRef, null); }
public void setPermission(StoreRef storeRef, String authority, PermissionReference permission, boolean allow) { Acl acl = getMutableAccessControlList(storeRef); 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)); aclDaoComponent.setAccessControlEntry(acl.getId(), entry); }
public void setPermission(PermissionEntry permissionEntry) { setPermission(permissionEntry.getNodeRef(), permissionEntry.getAuthority(), permissionEntry.getPermissionReference(), permissionEntry.isAllowed()); }
public boolean getInheritParentPermissions(NodeRef nodeRef) { Acl acl = null; try { acl = getAccessControlList(nodeRef); } catch (InvalidNodeRefException e) { return INHERIT_PERMISSIONS_DEFAULT; } if (acl == null) { return INHERIT_PERMISSIONS_DEFAULT; } else { return aclDaoComponent.getAccessControlListProperties(acl.getId()).getInherits(); } }
try AccessControlListDAO aclDAO = getACLDAO(nodeRef); if (aclDAO == null) case OLD: default: CreationReport report = getMutableAccessControlList(nodeRef); SimpleAccessControlEntry pattern = new SimpleAccessControlEntry(); pattern.setAuthority(authority); pattern.setPosition(Integer.valueOf(0)); List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern); getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes); break;
public void deletePermissions(StoreRef storeRef, String authority) { Acl acl = getAccessControlList(storeRef); if(acl == null) { return; } acl = getMutableAccessControlList(storeRef); SimpleAccessControlEntry pattern = new SimpleAccessControlEntry(); pattern.setAuthority(authority); pattern.setPosition(Integer.valueOf(0)); aclDaoComponent.deleteAccessControlEntries(acl.getId(), pattern); }
public NodePermissionEntry getPermissions(StoreRef storeRef) { // Create the object if it is not found. // Null objects are not cached in hibernate // If the object does not exist it will repeatedly query to check its // non existence. NodePermissionEntry npe = null; Acl acl = null; try { acl = getAccessControlList(storeRef); } catch (InvalidNodeRefException e) { // Do nothing. } if (acl == null) { // there isn't an access control list for the node - spoof a null one SimpleNodePermissionEntry snpe = new SimpleNodePermissionEntry(null, true, Collections.<SimplePermissionEntry> emptyList()); npe = snpe; } else { npe = createSimpleNodePermissionEntry(storeRef); } return npe; }