Retrieving all users with specified permission With a $user object, we can verify the user against a permission setting with the can() method. However, how can I retrieve all users who have a specific permission, including those under a group with the permission.

This needs to be generic PHP code as it's located in a service.
I don't think there is a clean or particularly efficient way of doing this using Craft's current services.

It'd have to be something like:

1. Grab all users
2. Loop through them calling craft()-&gt;userPermissions-&gt;doesUserHavePermission()
3. If true, save user in success array.


Alternatively you could use DbCommand to query the database directly for the info you're looking for.