List permissions over all documents

Do you know how to obtain the permissions that a user has over all documents in a workspace, via SQL?

0 votes

2 answers



I think it's not possible by using an NXQL querry however you can try directly in SQL (postgresql) :

SELECT AS "Document ID", AS "Document Name",
   acls.grant AS "Grant",
   acls.permission AS "Permission", 
   acls.user AS "User/Group ID" FROM acls 
LEFT JOIN hierarchy ON (hierarchy.parentId =
LEFT JOIN user2group ON ("user2group"."groupId" = acls.user)
WHERE hierarchy.parentId = '<documentId>' 
    AND ("user2group"."userId" = '<userId>' OR acls.user = '<userId>');

Replace <userId> and <documentId> according to your needs.

NB: This request not take into account rights inherited by groups. (try to make a more complicated request using 'group2group')

0 votes

Thanks. I am sad I can't use NXQL. Is there a way I can show this results in a UI?

The good way is to pass by the service provided by Nuxeo and use it in your own view. Generally, you never had to pass directly by an SQL request.

FWIW the reason why there's no built-in way to do this in NXQL is that NXQL was designed to return documents (CoreSession.query) or document's properties (CoreSession.queryAndFetch).

Conceivably something could be added to the existing NXQL framework to do what you want, but in what format do you propose that query results be returned?

0 votes