cancel
Showing results for 
Search instead for 
Did you mean: 

ACL cmis:read

mmaicas
Champ in-the-making
Champ in-the-making
Hi,

I'm having problems to assign permissions to a document using CMIS 1.1 Atom interface from Java
I have a workaround to the problem but the solution is specific to Alfresco ECM and I think it shouldn’t
<!–break–>
My first version was:

    public static void addReadAcl(CmisObject doc,
                                  String idUser)
            throws Exception {

        if (doc!=null) {
                System.out.println("Adding permissions to " + idUser + " over: " + doc.getId());

                // Make permissions object
                List<String> permissions = new ArrayList<String>();  
                permissions.add(BasicPermissions.READ);
                Ace aceIn = session.getObjectFactory().createAce(idUser, permissions);

                // Add permisions
                List<Ace> aceListAdd = new ArrayList<Ace>();
                aceListAdd.add(aceIn);
                doc.addAcl(aceListAdd, AclPropagation.OBJECTONLY);
        }
    }


Then I try to call several times to the function

addReadAcl(doc, "testUser1");
addReadAcl(doc, "testUser2");
addReadAcl(doc, "testUser3");

Only the first call was reflected over the document, testUser2 and testUser3 didn’t appear in the “admin permissions” of the document . If I changed the order of the users only the first seemed to have been taken into consideration.
After a debugging process I found a solution. I saw that when I assigned 'cmis:read' the system assigned 2 permissions [cmis:read, {http://www.alfresco.org/model/system/1.0}base.Read] so I changed the function



    public static void addReadAcl(CmisObject doc,
                                  String idUser)
            throws Exception {

        if (doc!=null) {
                System.out.println("Adding permissions to " + idUser + " over: " + doc.getId());

                // Make permissions object
                List<String> permissions = new ArrayList<String>();  
                permissions.add(BasicPermissions.READ);
                permissions.add("{http://www.alfresco.org/model/system/1.0}base.Read");
                Ace aceIn = session.getObjectFactory().createAce(idUser, permissions);

                // Add permisions
                List<Ace> aceListAdd = new ArrayList<Ace>();
                aceListAdd.add(aceIn);
                doc.addAcl(aceListAdd, AclPropagation.OBJECTONLY);
        }
    }


And then It works! I can call several times to the function an all users are added to document permissions.

The problem is that this solution is specific to Alfresco and we wanted a pure cmis solution.

Any idea or alternative?

Best regards,
Miguel A. Maicas

2 REPLIES 2

mrogers
Star Contributor
Star Contributor
Sounds like you may have found an issue that needs looking at.  Please raise it in JIRA.

Any solutions to now?

I'm a little bit confused about cmis implementation on Alfresco…

Ok I suggest…after few unit-test executions I realized that I can set, update and create folder and documents with cmis permissions, but when I retrieve them, they are enriched with alfresco model content permissions. Anyway I can update them without problems.

The problem I have now is about creation of a folder/document in a folder with permissions. It seems that new folder/document inherits container acls without adding the new ones except for those ACLs that contains Alfresco model content permissions, tts {http://www.alfresco.org/model/system/1.0}base.XXX or {http://www.alfresco.org/model/system/1.0}All.All.

Thanks.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.