use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AclDAOImpl method deleteInheritedAccessControlEntries.
/**
* {@inheritDoc}
*/
@Override
public List<AclChange> deleteInheritedAccessControlEntries(Long id) {
List<AclChange> changes = new ArrayList<AclChange>();
SimpleAccessControlEntry pattern = new SimpleAccessControlEntry();
pattern.setPosition(Integer.valueOf(-1));
// Will remove from the cache
getWritable(id, null, Collections.singletonList(pattern), null, null, true, changes, WriteMode.COPY_UPDATE_AND_INHERIT);
return changes;
}
use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AbstractPermissionsDaoComponentImpl method setPermission.
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);
}
use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AbstractPermissionsDaoComponentImpl method setPermission.
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);
}
}
use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AbstractPermissionsDaoComponentImpl method deletePermissions.
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);
}
use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AbstractPermissionsDaoComponentImpl method deletePermissions.
public void deletePermissions(NodeRef nodeRef, final String authority) {
Acl acl = null;
try {
AccessControlListDAO aclDAO = getACLDAO(nodeRef);
if (aclDAO == null) {
return;
}
acl = aclDAO.getAccessControlList(nodeRef);
if (acl == null) {
return;
}
} catch (InvalidNodeRefException e) {
return;
}
switch(acl.getAclType()) {
case FIXED:
case GLOBAL:
throw new IllegalStateException("Can not delete from this acl in a node context " + acl.getAclType());
case SHARED:
// Nothing to do
break;
case DEFINING:
case LAYERED:
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;
}
}
Aggregations