cancel
Showing results for 
Search instead for 
Did you mean: 

Node with certain permissions

luca
Star Contributor
Star Contributor
Is there a way to retrieve nodes with or without a certain permission inside a folder with a query?
2 REPLIES 2

vinhqchu
Champ in-the-making
Champ in-the-making
u can use the AuthenticationUtil.runAs to query as admin. this will give u all the results whether the actual user has permission or not.

luca
Star Contributor
Star Contributor
Thank You,
but I resolved using a query like this:

SELECT n.id, n.uuid, n.acl_id, q2.local_name as type,
       (SELECT np.string_value
          FROM alf_node_properties np, alf_qname q1
         WHERE np.node_id = n.id  AND  q1.id = qname_id  AND  q1.local_name = 'name') as NAME
  FROM alf_node n, alf_qname q2
WHERE q2.id = n.type_qname_id
   AND q2.local_name in ('folder', 'content')
   AND n.acl_id not in (
SELECT acl.id
  FROM alf_acl_member m,
       (SELECT ac.id, p.name, au.authority
          FROM alf_access_control_entry ac, alf_permission p, alf_authority au
         WHERE p.id = permission_id
           AND au.id = authority_id) ace,
       alf_access_control_list acl
WHERE ace.id = m.ace_id
   AND acl.id = m.acl_id
   AND ace.authority = 'GROUP_NAME'
   )