Is there any way to extend hasPermission without changing the core (to maintain simple upgradeability) ?
For my project, all actions occur in the front-end, using a connector&processors.
In many cases, the existing modx processors (core/model/modx/processors/) are useable "as is" - except the permissions logic.
for example:
if (!$modx->hasPermission('delete_document')) return $modx->error->failure($modx->lexicon('permission_denied'));
Moderators (super users) permissions work fine with the above (they get the permissions in the group, as designed in revo),
but, in addition - each user has the permission to control their own content (edit/delete/etc) - something that is not possible with current revo (maybe 2.1 ?)
A user is considered content owner simply by comparing user->get(’id’) to resource->get(’createdby’).
Currently, I duplicate the modx processor and modify the hasPermission line to fit my needs.
Would be very nice if I could just extend hasPermissions (which would be useful not only for the above case..)
Possible?
Thanks.
Addendum:
I am aware that there also ->checkPolicy , that needs to be taken care of. I assume it and hasPermissions are closely related.
The ideal solution would naturally be from the security side - granting specific permissions for users on the documents they own. but again - this is not possible in 2.0 (i would be happy to find out i’m wrong..)