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

Answered runProcessor

    • 42318
    • 25 Posts
    Hello everyone

    I am using runProcessor to create/update resources.

    I have a php script that does this on the front end of a website. But it only works if you're logged in as an administrator, or if the logged-in user has the right permissions.

    Can I bypass the permissions so that runProcessor will work? Is it the way that I set up the php class?

    I don't want to have to change the permissions for standard users. Or is there a way of just alllowing runProcessor to run - what would be the permissions for that?

    Thanks in advance!

    Tim

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      The create processor requires the new_document permission. If the resource will be in the root of the tree, new_document_in_root permission in required, otherwise, add_children permission for the resource parent is required.

      The update processor requires save_document permission and sometimes publish_document or unpublish_document.

      There's no way I know of to turn off the permission checks in the processor.

      If you really want to bypass them, you can create and update the resource directly with $modx->newObject('modResource') and $resource->save(), but the standard create and update System Events won't fire (e.g. OnDocFormSave, OnBeforeDocFormSave), so any plugins that depend on them (e.g., defaultResourceGroup) won't execute.

      Another method would be to create your own processors that extend those processors, and override any methods that check for permissions.
        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
        • 42318
        • 25 Posts
        That's perfect, thanks.
          • 42318
          • 25 Posts
          sorry, I can't see the add_children permission - where's that?
            • 3749
            • 24,544 Posts
            add_children is part of the Resource policy. I don't think it will apply if neither the resource nor the parent is protected by a Resource Group Access ACL entry.
              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