public void deletePermissions(StoreRef storeRef) { getACLDAO(storeRef).setAccessControlList(storeRef, null); }
private Acl getAccessControlList(StoreRef storeRef) { return getACLDAO(storeRef).getAccessControlList(storeRef); }
public void deletePermissions(StoreRef storeRef) { getACLDAO(storeRef).setAccessControlList(storeRef, null); }
private Acl getAccessControlList(StoreRef storeRef) { return getACLDAO(storeRef).getAccessControlList(storeRef); }
protected Acl getAccessControlList(NodeRef nodeRef) { return getACLDAO(nodeRef).getAccessControlList(nodeRef); }
protected Acl getAccessControlList(NodeRef nodeRef) { return getACLDAO(nodeRef).getAccessControlList(nodeRef); }
public AccessControlListProperties getAccessControlListProperties(NodeRef nodeRef) { Acl acl = getACLDAO(nodeRef).getAccessControlList(nodeRef); if(acl == null) { return null; } return aclDaoComponent.getAccessControlListProperties(acl.getId()); }
public AccessControlListProperties getAccessControlListProperties(NodeRef nodeRef) { Acl acl = getACLDAO(nodeRef).getAccessControlList(nodeRef); if(acl == null) { return null; } return aclDaoComponent.getAccessControlListProperties(acl.getId()); }
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; }
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; }
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 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 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 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); } }
private SimpleNodePermissionEntry createSimpleNodePermissionEntry(StoreRef storeRef) { Acl acl = getACLDAO(storeRef).getAccessControlList(storeRef); 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()); return snpe; } else { AccessControlList info = aclDaoComponent.getAccessControlList(acl.getId()); ArrayList<SimplePermissionEntry> spes = new ArrayList<SimplePermissionEntry>(info.getEntries().size()); for (AccessControlEntry entry : info.getEntries()) { SimplePermissionEntry spe = new SimplePermissionEntry(null, entry.getPermission(), entry.getAuthority(), entry.getAccessStatus(), entry.getPosition()); spes.add(spe); } SimpleNodePermissionEntry snpe = new SimpleNodePermissionEntry(null, acl.getInherits(), spes); return snpe; } }
private SimpleNodePermissionEntry createSimpleNodePermissionEntry(StoreRef storeRef) { Acl acl = getACLDAO(storeRef).getAccessControlList(storeRef); 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()); return snpe; } else { AccessControlList info = aclDaoComponent.getAccessControlList(acl.getId()); ArrayList<SimplePermissionEntry> spes = new ArrayList<SimplePermissionEntry>(info.getEntries().size()); for (AccessControlEntry entry : info.getEntries()) { SimplePermissionEntry spe = new SimplePermissionEntry(null, entry.getPermission(), entry.getAuthority(), entry.getAccessStatus(), entry.getPosition()); spes.add(spe); } SimpleNodePermissionEntry snpe = new SimpleNodePermissionEntry(null, acl.getInherits(), spes); return snpe; } }
private SimpleNodePermissionEntry createSimpleNodePermissionEntry(NodeRef nodeRef) Acl acl = getACLDAO(nodeRef).getAccessControlList(nodeRef); if (acl == null)
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(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); } }