Question

In Alfresco I've created a folder 'Board' whose contents should only be viewable by members of the group 'board'. I removed the inherited permissions from there and applied a new permission so that members of the group 'board' have the 'collaborator' permission.

I was expecting the following code to return an Acl that I could look at to see how these are constructed, but despite having applied a permission it's showing null. Am I doing something wrong or is this just not supported?

CmisObject object = session.getObjectByPath(path);

Acl acl = object.getAcl();
if (acl != null) {
    // Never reaches here, always returns null
    List<Ace> aces = acl.getAces();
    for (Ace ace : aces) {
        List<String> perms = ace.getPermissions();          
    }
}
Was it helpful?

Solution

You haven't requested the ACL. Try this:

OperationContext oc = session.createOperationContext();
oc.setIncludeAcls(true);

CmisObject object = session.getObjectByPath(path, oc);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top