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

    I am running MODX Revolution 2.2.10-pl (traditional) and occasionally when I save a resource I get an Access Denied error???? Only way to resolve this is to log out and then back in...

    Can someone look into it and issue a fix? I don't want to release this version of MODx to my client as this is not very good!

    Cheers,

    dubbs.
      • 37110
      • 72 Posts
      Is it the same as : https://forums.modx.com/thread/88049/modx-2-2-10-access-denied#dis-post-484735 ?
      It has to do with a administrator property inside the policy. I've changed the core, on an update it will be fixed i hope.
        • 8168
        • 1,118 Posts
        Quote from: wiegers at Jan 03, 2014, 07:15 AM
        Is it the same as : https://forums.modx.com/thread/88049/modx-2-2-10-access-denied#dis-post-484735 ?
        It has to do with a administrator property inside the policy. I've changed the core, on an update it will be fixed i hope.

        Thanks - Could you detail how you made your fix? That would help me and others to resolve this before a new MODx release fixes this rather major bug! Cheers
          • 37110
          • 72 Posts
          Open the file : core/modal/modx/modaccessibleobject.class.php
          Search for the function : function checkPolicy
          Insert after that line : if($criteria == 'administrator') return true;
            • 8168
            • 1,118 Posts
            Quote from: wiegers at Jan 03, 2014, 08:16 AM
            Open the file : core/modal/modx/modaccessibleobject.class.php
            Search for the function : function checkPolicy
            Insert after that line : if($criteria == 'administrator') return true;

            Thanks - will give that a go and see how it goes and report back
              • 3749
              • 24,544 Posts
              That should be core/model/modx ... wink
                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
                • 37110
                • 72 Posts
                Yes it should, good catch!
                  • 8168
                  • 1,118 Posts
                  OK, so

                  public function checkPolicy($criteria, $targets = null) {
                          if ($criteria && $this->xpdo instanceof modX && $this->xpdo->getSessionState() == modX::SESSION_STATE_INITIALIZED) {
                              if ($this->xpdo->user->get('sudo')) return true;
                              if (!is_array($criteria) && is_scalar($criteria)) {
                                  $criteria = array("{$criteria}" => true);
                              }


                  Becomes

                  public function checkPolicy($criteria, $targets = null) {
                  		
                  if($criteria == 'administrator') return true;
                  
                          if ($criteria && $this->xpdo instanceof modX && $this->xpdo->getSessionState() == modX::SESSION_STATE_INITIALIZED) {
                              if ($this->xpdo->user->get('sudo')) return true;
                              if (!is_array($criteria) && is_scalar($criteria)) {
                                  $criteria = array("{$criteria}" => true);
                              }
                    • 37110
                    • 72 Posts
                    Yes that should work.
                      • 8168
                      • 1,118 Posts
                      This does not appeared to have worked... still getting the Access denied prompt... I will clear site cache and try again...