We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35176
    • 193 Posts
    Hi

    My dev tells me that if i want to restrict a backend group to be able to edit only particular resources, it will reduce site performance. "the more security policies u add to anonymous the less performance u will get"

    • Can't I create read/write permissions for logged in backend groups which are SEPARATE from front-end access by website visitors? Seems to me that "Publish" is the setting which affects front-end access. I do not want to apply "anonymous" permissions on every public page on my website.
    • Can't I create per-object (per-resource) permissions for logged-in backend groups, without affecting performance, and without affecting front-end access?

    thanks! [ed. note: johnywhy last edited this post 14 years, 6 months ago.]
      jealousy<>love
      • 22303 MODX Staff
      • 10,725 Posts
      Resource Group ACLs specified in the mgr Context are limited to access by users of the manager. That should not affect front-end access or performance, but if there is evidence to the contrary, I would love to see the bug report.
        • 35176
        • 193 Posts
        you mean I do NOT have to add all my pages to an "anonymous" resource or user group? Even if I create backend resource or user groups?
          jealousy<>love
          • 31410
          • 66 Posts
          when you add a page to resource group you need to add the resource group access in web context otherwise you cant access the page in frontend
          let me tell u what he is looking for
          you created "devedit" resource group and you want only few pages r editable by dev user group and all other pages should be restricted from edit
          so you need to create public resource group too and add all other pages to public group and restrict this group mgr context access from dev group and "devedit" resourcegroup mgr context to dev group
          weird but thats the only way he can restrict all other pages from edit permissions and allow few pages

          here ends mgr context
          but whenever you add pages to a resource group you need update all usergroups.you have to add resourcegroup access in web context for the given resource group
          even for anonymous group (i know anonymous is not a usergroup)
          otherwise visitors cant see the page in front end
          so when you add resource group web context access to anonymous .modx will definitely check for permissions first .so does not this access lookup make the rendering slow?

          i know in theory the logic may not look perfect but thats the only way i have solved resource group access issues in frontend on many projects
          you cant create access policy per object or per resource .you have to go through all the procedure

          i know its a lengthy message but want to clear what he wants and how it works smiley

          Regards
            • 3749
            • 24,544 Posts
            when you add a page to resource group you need to add the resource group access in web context otherwise you cant access the page in frontend

            That's definitely not the case. It's only true if you connect that resource group to a user group with a context of 'web'.

            If all your Resource Group Access ACL entries have a context of 'mgr', they will have no effect in the front end of the site.

            It is true, though, that the way to hide resources in the Manager from User A is to put them in a resource group and connect that resource group to a user group User A is not a member of.

            It's also true that you can't protect individual resources, only resource groups.

            That usually means putting all resources on the site into one resource group (I call it AllDocs) and connecting the AllDocs resource group to the Administrator user group with a Resource Group Access ACL entry with a context of 'mgr' and a policy of 'Resource'. That will hide all resources from users who are not in the Administrator group.

            The DefaultResourceGroup plugin will put all new resources in a resource group for you automatically.

            A simple snippet will put all existing resources in the group:

            <?php
            /* Put all resources in AllDocs group */
            /* note: create the resource group first! */
            
            $resources = $modx->getCollection('modResource');
            
            $foreach ($resources as $resource) {
              $resource->joinGroup('AllDocs');
              $resource->save();
            }


            Then create a new resource group and user group for the resources the users *should* be able to see and connect them with a Context Access ACL entry as you did above with a context of 'mgr'.

            None of this will affect things in the front end as long as the context is 'mgr' for all the ACL entries.


            ---------------------------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
            MODX info for everyone: http://bobsguides.com/modx.html
              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
              • 31410
              • 66 Posts
              That's definitely not the case. It's only true if you connect that resource group to a user group with a context of 'web'.
              we create resource groups to set different web access permission so we added web context thats expected behavior
              but we had a problem for a 2.2 site where we only wanted mgr context for resource group .but the pages r not accessible in frontend until we added web context access (flush permission,remove web context from any user group not solved this problem)

              None of this will affect things in the front end as long as the context is 'mgr' for all the ACL entries
              yes it wont affect until you add web context access to the resource group but the main reason of resource group is to restrict web access to particular user groups (we can use em for mgr though)

              Regards
                • 35176
                • 193 Posts
                I actually want to restrict access to chunks, templates, etc, and Tge fine system tree, not just resources.

                I'm exploring ways to do this with categories.
                  jealousy<>love
                  • 3749
                  • 24,544 Posts
                  It works exactly the same way except that you create Element Category Access ACL entries instead of Resource Group Access ACL entries and you put the elements in Categories instead of Resource Groups.


                  ---------------------------------------------------------------------------------------------------------------
                  PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                  MODX info for everyone: http://bobsguides.com/modx.html
                    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
                    • 35176
                    • 193 Posts
                    we had a problem for a 2.2 site where we only wanted mgr context for resource group .but the pages r not accessible in frontend until we added web context access

                    Anyone have a fix for this?
                      jealousy<>love
                      • 3749
                      • 24,544 Posts
                      I've never seen a situation where a 'mgr' Resource Group Access ACL entry had any effect at all in the front end.

                      I suspect that the problem only occurred when previewing while logged in to the Manager.


                      ---------------------------------------------------------------------------------------------------------------
                      PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                      MODX info for everyone: http://bobsguides.com/modx.html
                        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