Does anyone know what the SQL would be to determine if a user ID has access to a given resource [i.e. the relations between which tables]
I know this can be done with a couple of functions/snippets [hasAccess] but I need to do this with sql for performance reasons.
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
You can look at the checkPolicy() method in core\model\modx\modaccessibleobject.class.php. If you can figure it out, you're way ahead of me.
If I had to know, I think I'd write an external snippet that instantiated MODX, with code something like this, then trace through it in a debugger:
$userId = 12; // set to a real user
$resource = $modx->getObject('modResource', 12); // set to a real resource
$hasPermission = $resource->checkPolicy('save');