We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17838
    • 82 Posts
    Hello,

    I would like to give SuperadminsUG (usergroup) permissions to save resources by using Ajax calls to /connectors/resource/index.php

    How should I set up permissions? Should I create new policy with ’save’ & ’save_document’?

    I even created new resource/document which acts as a static file connector (and which belongs to SuperadminsUG). All based on MODx documents. But it says:
    <b>Fatal error</b>:  Call to a member function get() on a non-object in <b>C:\wamp\www\core\model\modx
    
    \modresource.class.php</b> on line <b>300</b><br />


    In any case: I’d like users from SuperadminsUG could save public documents by Ajax calls from ’web’ context.
    How is it possible.

    --
    Regards
    MM
      • 17838
      • 82 Posts
      Ok,

      It was about giving WebUser proper policy: ’save’, ’save_document’. Could be only those attribs.

      It’s important user is logged into ’mgr’ context.
      vide: $_SESSION[’modx.user.contextTokens’][’mgr’] = 1;
        • 22303 MODX Staff
        • 10,725 Posts
        You can assign the policies to a context other than mgr. The user does not have to have a mgr context login, but you do have to log them into the context you want them to get the policy from.
          • 17838
          • 82 Posts
          Ok, but if I want to make Ajax calls to connectors (used by manager) from within ’web’ (or any other context) I will get permission denied (or empty Response in Revo2.0.0beta-3).

          It seems I have to write my own connectors and I can’t use existing ones.
            • 22303 MODX Staff
            • 10,725 Posts
            I have tested these before and it should work from any context you give a User Group access to the permissions defined in your policy.
              • 17838
              • 82 Posts
              But it didnt. I gave ’web’ context access permissions (context policy) to a UserGroup. And the user couldn’t get this data (he was SuperUser in this group). He had to be logged in to ’mgr’ context and have proper access permissions for that context (with proper policy - I just created one with few permissions).

              It’s true only for some connectors - they always return data (permission: true) but there’re some (quite a few) which return (permission: false) or even nothing.
                • 22303 MODX Staff
                • 10,725 Posts
                Maybe if you are more specific about what the attributes in your policies are and what connectors you are trying to access with them, we could have a more productive dialog on what the problem might be.
                  • 17838
                  • 82 Posts
                  url: MODx.config.connectors_url+’resource/index.php’

                  $_GET[’action’] = ’update’
                  $_POST has all resource fields needed to update.

                  I use custom policy: ’save’, ’save_document’, ’access_permissions’
                    • 22303 MODX Staff
                    • 10,725 Posts
                    In order to use the Resource update processor from, for example, the web context, you would need save_document and possibly publish_document. The save attribute refers to the ability to save changes to the context object itself in this case, FYI. In addition, you need to make sure the user has the save attribute on the Resource policy, if any are applied via Resource Groups. Regardless, the response from the connector should at least give you the appropriate security error if you don’t have those attributes. If you are getting other errors, say in core/cache/logs/error.log related to the connector, then we have other issues to discuss.

                    Sorry for the slow response; I’ve been extremely ill the past week and a half...
                      • 16183
                      • 1,390 Posts
                      Quote from: OpenGeek at Aug 04, 2009, 10:00 AM

                      I’ve been extremely ill the past week and a half...

                      Sorry about that. Hope nothing serious. Get well soon!

                      cheers/k