Quote from: jrotering at Mar 10, 2010, 09:54 AM
Just for kicks, I decided to open the Administrator Access Policy in my Revo b5 installation and compare. My assumption was that every permission in the documentation would be in the Administrator policy. But I found that there were several permissions in the documentation that weren’t in the Admin policy, and vice versa. Is this simply a matter of the documentation being out-of-sync with the latest beta? Or what?
The docs are probably more in-sync with SVN, which has a few new permissions.
2. What the heck are these permissions, anyway? I can open any Access Policy and add a new permission called anything I want... but what good does that do me? Is there really a hypothetical situation where an end user would need to create a custom permission for something? If so, how would they go about making it useful?
Oh, yes. For example, custom Extras (3PCs, or 3rd Party Components) can use Permissions to add their own security schemes.
For example, let’s say you had a 3PC that managed financial accounts. You could add permissions called ’view_account’, ’save_account’, etc, add an ’AccountPolicy’, and use $modx->hasPermission in your 3PC code to restrict access to certain parts of your 3PC via the permission scheme. This gives you incredibly fine-tuned access permission schemes at your fingertips, built into the core of Revolution.
3. I’m dangerous enough to have figured out that these permissions live in the table ’modx_access_permissions’. But I was expecting to find a table where the permission name was a unique key... but instead each record is a permission tied to a specific policy. I understand the usefulness of the table as it stands, but it feels like there should be some other table with one entry for each permission... essentially the list I linked to above.
TBH, we debated this for quite a while, but found that we’d rather have permissions be policy-specific rather than global. There really was no benefit to making Permission keys global, and it eventually would cause problems with conflicts across different policies. So, we’re using Policies as a sort of ’namespacing’ for Permissions.
Good questions!