We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I’m trying to figure out how this works.

    It works fine for simply hiding elements, but even though there is a policy attached to each ACL entry here, the effect is confusing.

    I’m basing the policy on the standard Resource policy (though I’ve filed a suggestion in Jira to add a standard Element policy).

    If I remove the "save" permission, the users can still save elements in the category because they have "save" and "save_chunks" in the admin policy in the mgr Context Access ACL. If I remove them from the Admin policy, and add them both to the policy attached to the Category Access ACL, the user can edit a chunk in the category, but gets "Permission Denied" when he tries to save it.

    I haven’t tried this with resources yet, just elements.

    So, do the permissions in the Category Access ACL policy have any effect at all? Are they intended to? Or am I just confused? tongue
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: BobRay at May 31, 2010, 03:41 AM

      I’m trying to figure out how this works.

      It works fine for simply hiding elements, but even though there is a policy attached to each ACL entry here, the effect is confusing.

      I’m basing the policy on the standard Resource policy (though I’ve filed a suggestion in Jira to add a standard Element policy).

      If I remove the "save" permission, the users can still save elements in the category because they have "save" and "save_chunks" in the admin policy in the mgr Context Access ACL. If I remove them from the Admin policy, and add them both to the policy attached to the Category Access ACL, the user can edit a chunk in the category, but gets "Permission Denied" when he tries to save it.

      I haven’t tried this with resources yet, just elements.

      So, do the permissions in the Category Access ACL policy have any effect at all? Are they intended to? Or am I just confused? tongue
      I sure am confused. tongue

      If an Element is in a category that a user does not have save permission on, he should not be able to save that object. The exception would be if he inherited the permission from a parent category. The more common usage though would be to completely hide Categories an the Elements within them from the UI, by giving certain user groups explicit rights to load them (and this would prevent users not in the proper groups from even accessing the Categories or Elements in question).

      AFAIK, the only permissions that have any effect on Category Access ACL’s at the current time are the core modAccessibleObject permissions, load, save, and remove. Any others would have to be checked explicitly in the code that uses these objects, i.e.
      <?php
      $object->checkPolicy(array('permission' => true, 'another_permission' => true));
      ?>


      I wonder if having policies like Read-Only (only has load, list, and maybe view permission), Read-Write (load, list, view, save), and Read-Write-Remove (load, list, view, save, and remove) would be helpful. These could apply to any Access Control List following the core implementation. We would probably need to be more consistent with using list and view permissions, as well as with implementing a "delete" functionality to a trash bin for all objects in a consistent way.
        • 3749
        • 24,544 Posts
        Hmmm. This raises a bunch more questions for me. I’ll try to make them as explicit as I can.

        Assuming that everything is working as it should ...

        Forgetting about Element Category ACLs for a minute (assume there are none), in the Administrator Policy attached to the mgr Context Access ACL entry for a user:

        -- The user has "save" but not "save_chunks" -- can he save chunks?
        -- The user has "save_chunks" but not "save" -- can he save chunks?

        Now, add in the Element Category ACL with the chunks in the named category (it’s the only category):

        -- The user has "save" and "save_chunks" in the Administrator Policy attached to the mgr Context Access ACL entry, but not in the Resource policy attached to the Element Category ACL - can he save chunks in the category?

        -- Reverse the above -- can he save chunks in the category?

        If a user has both a mgr Context Access ACL entry and a web Context Access ACL entry (necessary to see resources in that context in the tree), will the permissions in the *web* ACL entry affect what the user can do in the Manager with resources in that context (e.g. edit, save)? IOW, if the user has "save" and "save_chunks" in the web ACL entry but not in the mgr ACL entry:

        -- Can he save chunks in the web context in the manager?

        -- If he doesn’t have those permissions in the category, can he save chunks in the category?

        -- Can he save chunks *not* in a category?

        Re the Read, Read-Write, Read-Write-Remove idea, would the current specific permissions (save, save_chunks, view_snippets, etc.) be removed from the standard policies? If added back in, would they override? I.e. if a user had just "Read" permission, would adding save_chunks to the policy allow the user to save chunks? I think I like the idea.

        (now my brain hurts) tongue

          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: BobRay at May 31, 2010, 01:34 PM

          (now my brain hurts) tongue
          You are making mine hurt too. I think you are over-analyzing this a bit.

          The target of the ACL is the object to which the "core" permissions apply. Again ONLY load, save, and remove.

          That said, Elements and Resources themselves are not actual targets of an ACL, IOW their policies are loaded by proxy from Categories and Resource Groups respectively.

          So with that in mind, let’s answer your specific questions:
          Quote from: BobRay at May 31, 2010, 01:34 PM

          in the Administrator Policy attached to the mgr Context Access ACL entry for a user:

          -- The user has "save" but not "save_chunks" -- can he save chunks?
          -- The user has "save_chunks" but not "save" -- can he save chunks?
          He cannot save chunks in the first scenario, but can in the second. The target of the Context ACL’s are modContext objects and load/save/remove only apply when operating on the modContext objects.

          Quote from: BobRay at May 31, 2010, 01:34 PM

          Now, add in the Element Category ACL with the chunks in the named category (it’s the only category):

          -- The user has "save" and "save_chunks" in the Administrator Policy attached to the mgr Context Access ACL entry, but not in the Resource policy attached to the Element Category ACL - can he save chunks in the category?
          First, Resource policy? Create a policy for your Element Categories. Regardless it depends on what is in the policy attached to the Category. Does it have load and save? If so, then yes, he can load and save both the modCategory object and the modChunk (derivative of modElement). In this case, the load/save/remove core permissions apply to both the Category objects and the Element objects they are related to. In addition, policies are inherited from parent Categories, which also must be take into consideration.

          The short answer is yes, if you attached the default Resource policy, he can save chunks in the category.

          Quote from: BobRay at May 31, 2010, 01:34 PM

          -- Reverse the above -- can he save chunks in the category?
          save_chunks in the manager will override specific object permissions like load, save, remove. The manager application and core processors are coded to respect these permissions explicitly. If he has load and save in the policy attached to the category (or a parent category) of the chunk, it doesn’t matter this time, because he can’t save_chunk in general.

          Quote from: BobRay at May 31, 2010, 01:34 PM

          If a user has both a mgr Context Access ACL entry and a web Context Access ACL entry (necessary to see resources in that context in the tree), will the permissions in the *web* ACL entry affect what the user can do in the Manager with resources in that context (e.g. edit, save)? IOW, if the user has "save" and "save_chunks" in the web ACL entry but not in the mgr ACL entry:
          Other than the core permissions of load/save/remove, which affect being able to "see" a Context in the manager, the other permissions in a context access ACL define what a user can do "from" that context. IOW, a front-end administration extra operating in the "web" Context would determine it’s permissions to perform actions in the core processors from a "Front-End Administration" policy attached to the Web context. It might be best to start separating the Context ACL policy permissions from the core permissions that define whether you can "load/save/remove" the Context from any context including the mgr. Back to that on the Read, Read-Write, Read-Write-Remove discussion.

          Quote from: BobRay at May 31, 2010, 01:34 PM

          -- Can he save chunks in the web context in the manager?
          Context ACL’s are global to actions taken in that context, so if the policy attached to the mgr context has save_chunks, the user can save chunks in the mgr. Attaching save_chunks to the web context is currently meaningless, unless you execute a core processor from the web context (IOW front-end editing).

          Quote from: BobRay at May 31, 2010, 01:34 PM

          -- If he doesn’t have those permissions in the category, can he save chunks in the category?
          If a category is protected by at least one ACL entry, then he if he doesn’t have save on the category (or a parent category) then he will not be able to save chunks in the category (unless he is a member of the User Group attached to that ACL entry.

          Quote from: BobRay at May 31, 2010, 01:34 PM

          -- Can he save chunks *not* in a category?
          Same as the first, scenario. This is determined only by a core processor permission, save_chunk, based on the context the action is being taken in, i.e. the mgr.

          Quote from: BobRay at May 31, 2010, 01:34 PM

          Re the Read, Read-Write, Read-Write-Remove idea, would the current specific permissions (save, save_chunks, view_snippets, etc.) be removed from the standard policies? If added back in, would they override? I.e. if a user had just "Read" permission, would adding save_chunks to the policy allow the user to save chunks? I think I like the idea.
          This is more to differentiate between object permissions and content management permissions, which I think is where most of the confusion comes in. If we take Context ACLs out of the equation, all we are talking about is object permissions, or permissions that apply to specific instances of an object. Though these can also apply to Contexts, Contexts also define an entirely different set of permissions that define what core content management activities can be performed from that Context. So instead of load/save/remove for Contexts being defined in your default Administration policy, they would be defined and applied separately as a Read, Read/Write or Read/Write/Remove policy. This would isolate the permissions based on how they apply and avoid any confusion about a Context ACL save permission having anything to do with saving anything other than the Context object itself.
            • 3749
            • 24,544 Posts
            Quote from: OpenGeek at May 31, 2010, 02:27 PM

            Quote from: BobRay at May 31, 2010, 01:34 PM

            Now, add in the Element Category ACL with the chunks in the named category (it’s the only category):

            -- The user has "save" and "save_chunks" in the Administrator Policy attached to the mgr Context Access ACL entry, but not in the Resource policy attached to the Element Category ACL - can he save chunks in the category?
            First, Resource policy? Create a policy for your Element Categories. Regardless it depends on what is in the policy attached to the Category. Does it have load and save? If so, then yes, he can load and save both the modCategory object and the modChunk (derivative of modElement). In this case, the load/save/remove core permissions apply to both the Category objects and the Element objects they are related to. In addition, policies are inherited from parent Categories, which also must be take into consideration.

            The short answer is yes, if you attached the default Resource policy, he can save chunks in the category.

            But I didn’t use the default Resource policy. I duplicated it (because there is no "Element: policy) and removed "save." I flushed everything, but the user can still save the chunks in the category. Can you confirm that this works as it should? Maybe I’m doing something wrong.


            If a category is protected by at least one ACL entry, then he if he doesn’t have save on the category (or a parent category) then he will not be able to save chunks in the category (unless he is a member of the User Group attached to that ACL entry.

            Again, I’m not getting this to work the way I understand it to work. I have a user who is a member of a group tied to an element category with a Category Access ACL entry. The policy defining that user’s access to the category does not have "save" in it, yet the user can save objects in the category.

            Quote from: BobRay at May 31, 2010, 01:34 PM

            Re the Read, Read-Write, Read-Write-Remove idea, would the current specific permissions (save, save_chunks, view_snippets, etc.) be removed from the standard policies? If added back in, would they override? I.e. if a user had just "Read" permission, would adding save_chunks to the policy allow the user to save chunks? I think I like the idea.


            This is more to differentiate between object permissions and content management permissions, which I think is where most of the confusion comes in. If we take Context ACLs out of the equation, all we are talking about is object permissions, or permissions that apply to specific instances of an object. Though these can also apply to Contexts, Contexts also define an entirely different set of permissions that define what core content management activities can be performed from that Context. So instead of load/save/remove for Contexts being defined in your default Administration policy, they would be defined and applied separately as a Read, Read/Write or Read/Write/Remove policy. This would isolate the permissions based on how they apply and avoid any confusion about a Context ACL save permission having anything to do with saving anything other than the Context object itself.

            I agree about object permissions and those "other" permissions. I find "content management" permissions unsatisfying, though -- "action" permissions? "manager" permissions (even in the front-end, you could argue that they are manager actions).

            That said, clarifying the difference should help a lot.

            I just realized that you’re talking about Read, Read/Write, and Read/Write/Remove *policies* rather than permissions. I see the value, but the down side would be having that many different policies. I think I’d rather see just three default policies (Administrator, Resource, and Element) and have read, write, and save in as the first three permissions in the Resource and Element policies.

            What if we called the default policies something like: AdministratorAction, ResourceObject, and ElementObect?

            I think it also would help a lot to put the individual permissions for a policy in a grid where they’re forced to Yes/No types (with the option to add new permissions -- also forced to Yes/No). That way, users could see all the possible standard permissions and turn them on and off without having to know their exact names.

            Let me also get clarification on the interaction of permissions in Context Access ACLs and Category Access ACLs. My understanding is that a Context Access ACL gives you permission to do stuff with unprotected objects. For protected objects, you need permission in both the Context Access ACL *plus* the Category or Resource Group ACL. Is that right?



              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: BobRay at Jun 01, 2010, 11:47 PM

              Let me also get clarification on the interaction of permissions in Context Access ACLs and Category Access ACLs. My understanding is that a Context Access ACL gives you permission to do stuff with unprotected objects. For protected objects, you need permission in both the Context Access ACL *plus* the Category or Resource Group ACL. Is that right?
              No; the Context Access ACLs control two different things, the Context object permissions (what Contexts they are allowed to load/save/remove), and the Context action permissions (i.e. what content management actions they can perform from those contexts). The load/save/remove in a Context ACL have no effect on loading/saving/removing of other objects like Resources or Elements.
                • 3749
                • 24,544 Posts
                Quote from: OpenGeek at Jun 02, 2010, 10:13 AM

                Quote from: BobRay at Jun 01, 2010, 11:47 PM

                Let me also get clarification on the interaction of permissions in Context Access ACLs and Category Access ACLs. My understanding is that a Context Access ACL gives you permission to do stuff with unprotected objects. For protected objects, you need permission in both the Context Access ACL *plus* the Category or Resource Group ACL. Is that right?
                No; the Context Access ACLs control two different things, the Context object permissions (what Contexts they are allowed to load/save/remove), and the Context action permissions (i.e. what content management actions they can perform from those contexts). The load/save/remove in a Context ACL have no effect on loading/saving/removing of other objects like Resources or Elements.

                I’ve been ignoring the ability to load/save/remove context objects themselves because I’m assuming that it would be extremely rare for a user with limited access to do any of those things.

                I understood you earlier to say that a user who had save rights to an Element Category couldn’t save chunks without also having save_chunks permission in the Context Access ACL for the mgr context. This seems to contradict what you say here about Context ACLs having no effect on saving elements, or is this the difference between load and load_chunks? load has no effect, but load_chunks does? If so, it seems potentially confusing to have permissions with different scopes (or at least different targets) in the same policy.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 3749
                  • 24,544 Posts
                  Thoughts?
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: BobRay at Jun 02, 2010, 06:24 PM

                    I understood you earlier to say that a user who had save rights to an Element Category couldn’t save chunks without also having save_chunks permission in the Context Access ACL for the mgr context. This seems to contradict what you say here about Context ACLs having no effect on saving elements, or is this the difference between load and load_chunks? load has no effect, but load_chunks does? If so, it seems potentially confusing to have permissions with different scopes (or at least different targets) in the same policy.
                    The Context ACLs have no effect on a specific database object that represents a specific Chunk. But they have effect on the ability to take the save_chunk action in the manager on any Chunk, so thus it trumps any/all save permissions a user may get through a Category ACL. Context ACLs define load/save/remove for Context objects; the rest of the permissions in a Context Policy define generic content management "actions" a user may take from that Context. Additional ACLs like Category or Resource Group ACLs define load/save/remove + any additional permissions that pertain to specific instances of those objects (or related objects, i.e. Category -> Elements, Resource Group -> Resources).
                      • 3749
                      • 24,544 Posts
                      So is this the correct matrix with respect to save_chunk and save_document in the context access policy and save in the resource/category policy?


                      [table]
                      [tr][td]Context permission [/td] [td]Category/Resource Group permission [/td][td]Can save chunks in the Category/Resource?[/td][/tr]
                      [tr][td]save_chunk/save_document [/td][td]save[/td][td]Yes[/td][/tr]
                      [tr][td]save_chunk/save_document [/td][td]X[/td][td]No[/td][/tr]
                      [tr][td]X[/td][td]save[/td][td]No[/td][/tr]
                      [tr][td]X[/td][td]X[/td][td]No[/td][/tr]
                      [/table]
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting