When doing pagination in Grails, you need to know the total number of objects a person can see.
When Domain Objects (in this example a Domain Class Project
) are secured by ACL, this becomes problematic.
Here's a quick solution to find the number of objects under ACL security that a given user can see.
Basically, if the user is not ROLE_ADMIN
, then we join the ACL tables, and return a count of those where the current user is the owner
, or has READ | WRITE | ADMINISTRATION
flags set