コード例 #1
0
 public function IsUserAllowed()
 {
     $bRet = true;
     $aProfiles = UserRights::ListProfiles();
     foreach ($this->aData['deny'] as $sDeniedProfile) {
         // If one denied profile is present, it's enough => return false
         if (in_array($sDeniedProfile, $aProfiles)) {
             return false;
         }
     }
     // If there are some "allow" profiles, then by default the result is false
     // since the user must have at least one of the profiles to be allowed
     if (count($this->aData['allow']) > 0) {
         $bRet = false;
     }
     foreach ($this->aData['allow'] as $sAllowProfile) {
         // If one "allow" profile is present, it's enough => return true
         if (in_array($sAllowProfile, $aProfiles)) {
             return true;
         }
     }
     return $bRet;
 }