Commit f5163f3f authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza

Extend ACL service

- clear ACL cache
parent a05c6557
......@@ -69,6 +69,22 @@ public interface CustomAclService {
*/
void createOrUpdatePermissions(AclAwareModel entity);
/**
* Updates inheriting status of object identity
*
* @param objectIdIdentity the id of object identity
* @param entriesInheriting the inheriting status
*/
AclObjectIdentity updateInheriting(long objectIdIdentity, boolean entriesInheriting);
/**
* Updates parent object of object identity
*
* @param objectIdIdentity the id of object identity
* @param parentObjectId the id of parent object identity
*/
AclObjectIdentity updateParentObject(long objectIdIdentity, long parentObjectId);
/**
* Removes the permissions on ACL model.
*
......
......@@ -184,6 +184,52 @@ public class CustomAclServiceImpl implements CustomAclService {
}
}
@Override
@PreAuthorize("hasRole('ADMINISTRATOR')")
public AclObjectIdentity updateInheriting(final long objectIdIdentity, final boolean entriesInheriting) {
final AclObjectIdentity objectIdentity = aclObjectIdentityPersistence.findOne(objectIdIdentity);
if (objectIdentity == null) {
LOG.warn("ACL object identity not found by id={}", objectIdIdentity);
return null;
}
if (objectIdentity.isEntriesInheriting() == entriesInheriting) {
return objectIdentity;
} else {
try {
LOG.info("Updating inheriting status for OID={} to {}", objectIdentity, entriesInheriting);
objectIdentity.setEntriesInheriting(entriesInheriting);
return aclObjectIdentityPersistence.save(objectIdentity);
} finally {
clearAclCache();
}
}
}
@Override
@PreAuthorize("hasRole('ADMINISTRATOR')")
public AclObjectIdentity updateParentObject(final long objectIdIdentity, final long parentObjectId) {
final AclObjectIdentity objectIdentity = aclObjectIdentityPersistence.findOne(objectIdIdentity);
if (objectIdentity == null) {
LOG.warn("ACL object identity not found by id={}", objectIdIdentity);
return null;
}
final AclObjectIdentity parentObject = aclObjectIdentityPersistence.findOne(parentObjectId);
if (parentObject == null) {
LOG.warn("ACL object identity not found by id={}", objectIdIdentity);
return null;
}
try {
LOG.trace("Updating ACL parent to {}", parentObject);
objectIdentity.setParentObject(parentObject);
return aclObjectIdentityPersistence.save(objectIdentity);
} finally {
clearAclCache();
}
}
/**
* Remove ACL data for AclAwareModel: deletes {@link AclObjectIdentity} and
* associated {@link AclEntry} list. If target happens to be {@link AclSid},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment