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

    I'm working on a project which uses different contexts as different TLD websites. Each context has an Editor and their role is based on the Administrator Access Policy Template with a fair amount of permissions removed.

    I duplicated the AdministratorTemplate and renamed it as something else. Then I created a new Access Policy based on that template and unticked the options I didn't want them to have. All good so far.

    The problem I have is that the new users cannot create new documents. new_document and new_document_in_root are both checked and I've been into the database itself and the settings seem to have stuck OK.

    I have also created a setting for each context under 'Allow root' and set it to 'Yes'.

    The truly odd thing is that users can duplicate a document but not create a new one. Can anyone suggest some troubleshooting ideas please?

    Revo 2.2.4-pl [ed. note: tobyyoto last edited this post 14 years ago.]
      • 37746
      • 42 Posts
      Just to add, the error I get when I try and create a new document is
      context_err_nf
        • 3749
        • 24,544 Posts
        Does the user have a *Context* Access ACL entry giving them access to the Context (e.g., 'web') that that resource is being created in? And does the Policy for that ACL entry have the appropriate permissions set? You need an ACL entry like that for each Context.

        That error usually means that MODX can't find an appropriate Context Access ACL entry for what you're trying to do.


        ------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using.
        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
          • 37746
          • 42 Posts
          Thanks for the input Bob. I believe that my Context Access ACL entry is correct (I followed your tutorial so thanks for that) and, after some further testing I've found the following;


          • If I create a new document in the root of the context by using the right-click method, input a title and a resource alias then it will work no problem
          • If I create a new document in the root of the context by using the right-click method, input a title and a resource alias and try and select a different template to use then I get the 'context_err_nf' message
          • If I click any of the 'create new' buttons at the top of the resource tree then I immediately get the 'context_err_nf' message
          • If I click any of the 'create new' buttons in the top menu (under 'site') then I immediately get the 'context_err_nf' message

          Do you think this is something I have done in a strange way or is it a quirk/bug of 2.2.4-pl?
            • 37746
            • 42 Posts
            OK, I think I'm understanding a bit more about the problem I am having. Reading around, the 'Create New Document' button is trying to create a new resource in a context the user is not allowed to access (hence the error). So can I specify by usergroup which is their default context when that button is pressed? So I can say that the button should create a new resource under the context they are editor for rather than 'web' to avoid the evil error message?
              • 3749
              • 24,544 Posts
              I don't think so (but I think you're right about what the problem is). default_context is a System Setting, so you'd have to create a User Setting with that key and the correct value for each user. That should work, but I've never tried it.

              You could write a simple utility snippet that created all the User Settings, or a plugin that set it automatically at some point.

              If that doesn't work, you'll may have to teach users to right-click on their Context.


              ------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using.
              MODX info for everyone: http://bobsguides.com/modx.html [ed. note: BobRay last edited this post 14 years ago.]
                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
                • 37746
                • 42 Posts
                That's got it Bob, perfect smiley Thanks ever so much for your help on this one (and your tutorials for helping me understand permissions, users, roles etc.) I can now hand this over to the client(s) without any error messages and can stop worrying about it over the weekend as well!
                  • 37746
                  • 42 Posts
                  Mods, please mark as 'solved' as well (couldn't find how I can do that myself).
                    • 3749
                    • 24,544 Posts
                    You're welcome. smiley


                    Just edit the subject in a reply or edit one of your posts and add [SOLVED] at the beginning.


                    ------------------------------------------------------------------------------------------
                    PLEASE, PLEASE specify the version of MODX you are using.
                    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
                      • 37746
                      • 42 Posts
                      Thanks again Bob, done and done smiley