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

1775 views

ANSWER



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

SELECT hierarchy.id AS "Document ID",
   hierarchy.name 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 = acls.id)
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?
10/31/2011

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


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