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

    So I was wondering if it was possible to allow users from a certain IP address access to all secured content? I am using modx 101. I have currently added code to user_documents_permissions_class.php.

    I added

    if($_SERVER[’REMOTE_ADDR’] == ’xxx.xxx.xxx.xxx’)
    {
    return true;
    }

    So far that is not working. I also added a line to document.parser.class.inc.php
    function hasPermission($pm) {
    $state= false;
    $pms= $_SESSION[’mgrPermissions’];
    if ($pms)
    $state= ($pms[$pm] == 1);
    if($_SERVER[’REMOTE_ADDR’] == ’xxx.xxx.xxx.xxx’)
    {
    $state = true;
    }
    return $state;
    }

    Is there another place I need to add something?? Thanks for your help!!

    ~bigboyfuge
      • 3314
      • 2 Posts
      I figured it out after some time. All thats needed is to assign all documents to the ip that you want. This bypasses all login.

      function getUserDocGroups($resolveIds= false) {
      if ($this->isFrontend() && isset ($_SESSION[’webDocgroups’]) && isset ($_SESSION[’webValidated’])) {
      //////
      //////Modification to allow manager to see frontend preview
      //////
      $dg= $_SESSION[’webDocgroups’];
      $dgn= isset ($_SESSION[’webDocgrpNames’]) ? $_SESSION[’webDocgrpNames’] : false;
      } else
      //GAIA EDIT
      if ($this->isBackend() && isset ($_SESSION[’mgrDocgroups’]) && isset ($_SESSION[’mgrValidated’]) ||
      $this->isFrontend() && isset ($_SESSION[’mgrDocgroups’]) && isset ($_SESSION[’mgrValidated’])
      ) {
      $dg= $_SESSION[’mgrDocgroups’];
      $dgn= $_SESSION[’mgrDocgrpNames’];
      }
      //***** Start Modified code for allowing access to all documents by ip*******//
      elseif($_SERVER[’REMOTE_ADDR’] == ’xxx.xxx.xxx.xxx’)
      {
      $dg = array(’0’, ’1’);
      }
      //***** End Modified code for allowing access to all documents by ip*******//
      else {
      $dg= ’’;
      }