ACLs - Priorities not working for groups
This issue is related to updates to CiviCRM's ACL functionality that had been implemented last year. In 2023, two new functions for ACL have been developed:
- Negative ACLs (to be able to have "Allow" and "Deny" rules)
- Weightings / Priotities for ACLs
When testing the new ACL funtionalities today, I realized that there (still?) is an issue regarding the priorities when dealing with groups.
Test setup:
- Create a test user ("X") that does not have the right to view all contacts
- Create two groups (Group A and Group B)
- Create a test contact ("Y") that is a member of both groups
Then create two ACLs:
- Role "Authenticated", Operation "View", Type "Group", Mode "Allow", Priority "1", Group "Group A"
- Role "Authenticated", Operation "View", Type "Group", Mode "Deny", Priority "2", Group "Group B"
- Log in with the test user "X" and check if you're able to see the test contact "Y"
Behaviour: I can see the test contact "Y", even though the higher priority rule (No. 2) should prevent me from seeing "Y".
Expected Beaviour: I can't see test contact "Y". Even though rule No. 1 allows me to view "Y" (as a member of Group A), rule No. 2 denies me to view "Y" (as a member of Group B). Since rule No. 2 has the higher priority, I am not able to see "Y".
Interestingly the priorities seem to work fine regarding sets of custom fields(!).
I'd be happy to do more testing. A lot of people pitched in last year to finance the new ACL functionalities. Now it would be great to get rid of this last problem to be able to fully use this in a productive setting.
As soon as this has been solved, I'd be also happy to write an update for the CiviCRM documentation describing the new functionalities. I really do believe that these functionalities could be very useful for a lot of people.
Thanks and best regards!
Tobias