With more sophisticated logic it's possible the standard logic is not enough and some custom logic to decide whether a user can masquerade as another user is needed.
The attached patch adds a new hook to add this feature.
It also tried to streamline the logic of the module, with a single new function which performs the check.
Testing.
None.
A new hook has been added.
In the refactoring the permissions I tried to apply the existing permissions in a strict way:
- a user needs at least "masquerade as user" to perform any logic
- a user with "masquerade as any user" can masquerade as any user, standard or admin depending on the "masquerade as admin" permission
It is possible that some site has a different interpretation of these permissions and that this breaks their logic; if it does, it should at worst revoke some permissions, rather than grant them.
None.
Active
1.0
Code