We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28840
    • 46 Posts
    I need to filter the resource tree nodes based on context. I need to see only "web" context while other context (webAlfa, webBeta) need to be hidden (actually the resources inside them).

    The idea was to filter the getNodes request but there is no event that is triggered in there.

    Does anyone have any idea how to pull this off?

    Sumoborac

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

      • 28840
      • 46 Posts
      I found an easy solution but it's ugly.. changing the core files sad

      All I did, was to add an extra "System event" called OnResourceGetNodes and added in processors/resource/getnodes.class.php on line 62:
       $this->modx->invokeEvent('OnResourceGetNodes',array(
                  'items' => &$this->items,
                  'contextKey' => $this->contextKey
              ));

      And did the filtering in the plugin.


      Since editing the core files is stupid and will be replaced on next "update"... does anyone have any other suggestions?

      Sumoborac
        • 28840
        • 46 Posts
        Anyone? No one?
          • 40706
          • 128 Posts
          U just need an ACL and an secound Usergroup

          1st Edit the Administator Usergroup, and go to Context-Access. Give this Admin Group Administrator Access for the Superuser Role. for Both Contextes.

          Now Edit your 2nd Usergroup, which shouldn`t see this 2 contextes. Add only the "web" context with maybe Resource Access for the "Member" Role.

          Finally Reset all Sessions and login again, your not Administrator User should now only see the live Context and the other one is "hidden". In the same way you can add Usergroups for the other ones.

          But you never should restrict the Administrator Usergroup the Access, otherwise its not that easy to handle gaining access again.
            • 28840
            • 46 Posts
            ACL makes it only for specific user, i need to filter the nodes for administrator and it needs to be dynamic...

            Sumoborac
              • 17403 ☆ A M B ☆
              • 183 Posts
              create second administrator group (adminweb for example) using ACL. Give it access to mgr and web only.
                zaenal.lokamaya
                • 3749
                • 24,544 Posts
                If any Context is connected to a User Group with a Context Access ACL entry, its resources are hidden from *everyone* outside that User Group (unless their User Group has a similar Context Access ACL entry for the Context).
                  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
                • discuss.answer
                  • 28840
                  • 46 Posts
                  I want to do it dynamicly with a click of a button... Since there isnt a direct option maybe i'll dig in the ACL to see if i can set correct ACL entery "on-the-fly" while page is being loaded... Any suggestions?

                  Sumoborac