We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40002
    • 9 Posts
    hi
    i want a user for managing only part of my website so i created new accessPolicy with doplicating administrator pollicy and remove many cheks like update_resouce save_resouce and many others
    so the user cant edit any resources
    try to add access to part of the tree in manager with creating resource group and add AccessPolicy:Resource(ctx:mgr) but nothing happend

    how can i creat a usergroup with only access to edit/update the part of a tree(child of resource with ID=8) in manager?

    This question has been answered by multiple community members. See the first response.

      • 40045
      • 534 Posts
      how do you mean "nothing happened"?

      basically to hide everything else, you need to create an "admin" resource group (which your Usergroup has access to), add all resources to that group and then create another resource group like "client" and add the documents the client should be able to see to that resource group...
        • 3749
        • 24,544 Posts
          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
          • 40002
          • 9 Posts
          hello Dear BOB AND Dear exside and dear others

          i want two user groups

          1) super admin(me) -> access to every thing and every document
          2) news admin(my friend) -> only access to resource 8 and children of this resource

          this is the example tree of my website with two context(web/german):

          web
          |_welcome(1)
          |_about us(2)
          |_products(3)
          |_news(8)
          | |_awards(9)
          | |_new products(10)
          | |_other news(11)
          |
          |_some other pages(12)

          german
          |_welcome(4)
          |_about us(5)
          |_products(6)
          |_news(13)
          | |_awards(14)
          | |_new products(15)
          | |_other news(16)
          |
          |_some other pages(7)



          my user most access to evey pages
          my-friend user most access to (8 9 10 11 & 13 14 15 16 ) only

          if i add my-friend to admin group then he will be accessed to evey pages
          so i do the folowing changes :
          1)create a resource group called news-pages
          2)create access-policy from admin access-policy-template and remove some checks(update_resouce delete_resource save_resource ....) and name it "news-policy"
          3)create a user-group called news-manager
          4)add my-frind user to news-manager group
          5)add news-policy to news-manager group
          ---- in this state my-frind can view any page in manager with action 28(resource/data) and no access to action 30(resource/update)
          ---- in next states i most add edit and save access to pages : (8 9 10 11 & 13 14 15 16) so i did the folowing steps (bot nothing happend. i mean poermissions not changed)
          6)add created resource group in step 1 (news-pages) to news-manager group that i create in state 3
          i hope step 6 add access to pages 8-11 and 13-16 but nothing happend. my frind can only view any pages and no diffrent between page 8 and 4 or 12

          if i change news-policy (created in state 5) and checked update_resource and save_resource he can modify any pages in manager!!!! not only (8 9 10 11 & 13 14 15 16 ).

          help me please
          regards
          • discuss.answer
            • 40045
            • 534 Posts
            Please also check the following thread, I already did a step by step guide which could fit your needs (+ a lot of resources in there too):

            https://forums.modx.com/thread/?thread=80905
              • 40002
              • 9 Posts
              thanks

              It works but i have another question
              my site is developing very fast and many pages added to it daily
              in your solution i most add any resources to admin resource group (right after creation)
              and limited users resources most be added to their resource group (right after creation)

              so it is impossible for me to add all of them after creation one by one. maybe other solution is : creating plugin to add any created resource to a resource group (with checking user group whom created that resource)

              but is there any other solution that don`t need admin-resource-group?
              • discuss.answer
                • 40045
                • 534 Posts
                This is a major problem with resources group for a long time...but it didn't get fixed until today^^...

                http://tracker.modx.com/issues/8272
                http://tracker.modx.com/issues/5203

                I think I have seen something like a plugin that does that, not sure about it but I think it was from Bob Ray?! Something about adding resources to a desired resource group on creation...but I couldn't find it.

                [Edit]
                Thanks for the hint Bob!
                I ment that: http://modx.com/extras/package/defaultresourcegroup in combination with this: http://bobsguides.com/defaultresourcegroup-tutorial.html
                [/Edit]

                Some similar or helpful stuff you maybe find here:

                https://forums.modx.com/thread/76356/add-resources-to-the-anonymous-user-group-programmatically
                https://forums.modx.com/thread/44055/revo-set-a-default-resourcegroup-for-a-modresource
                https://forums.modx.com/thread/79531/inheriting-resource-groups

                where from the last thread I copied this code to inherit the resource group:

                // plugin triggered on OnDocFormSave
                /* Inherit resource groups only if resource is new */
                if ($mode == modSystemEvent::MODE_NEW) {
                    
                   /* get the id of the parent */
                   $parentId = $_POST['parent'];
                 
                   /* get all the resource group data of the parent as a collection */
                   $groupCollection = $modx->getCollection('modResourceGroupResource', array('document'=>$parentId));
                 
                   /* join the resource to resource groups in the collection */
                   foreach($groupCollection as $group) {
                      $success = $resource->joinGroup($group->get('document_group'));
                   }
                }
                
                [ed. note: exside last edited this post 13 years, 9 months ago.]
                  • 3749
                  • 24,544 Posts
                  Here's my Extra, but it's fairly limited. It adds all new Resources to the same Resource Group. http://modx.com/extras/package/defaultresourcegroup

                  If you can describe the logic of selecting an appropriate Resource Group to put a new resource in, and it would be of general use, maybe I can create a plugin to do it.

                    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
                    • 40002
                    • 9 Posts
                    thanks to bob and exside

                    my problem was solved

                    i will post my plugin if it compleated

                    regards