Ejemplo n.º 1
0
 /**
  * Checks if a given user-id is granted the passed permission for the passed systemid.
  *
  * @param string $strUserid
  * @param string $strPermission
  * @param string $strSystemid
  *
  * @return bool
  */
 public function checkPermissionForUserId($strUserid, $strPermission, $strSystemid)
 {
     if ($strSystemid == "") {
         return false;
     }
     if ($this->bitTestMode) {
         return true;
     }
     $arrGroupIds = array();
     if (validateSystemid($strUserid)) {
         if ($strUserid == $this->objSession->getUserID()) {
             $arrGroupIds = $this->objSession->getGroupIdsAsArray();
         } else {
             $objUser = new class_module_user_user($strUserid);
             $arrGroupIds = $objUser->getArrGroupIds();
         }
     } else {
         if (validateSystemid($this->objSession->getUserID())) {
             $arrGroupIds = $this->objSession->getGroupIdsAsArray();
         } else {
             $arrGroupIds[] = class_module_system_setting::getConfigValue("_guests_group_id_");
         }
     }
     foreach ($arrGroupIds as $strOneGroupId) {
         if ($this->checkPermissionForGroup($strOneGroupId, $strPermission, $strSystemid)) {
             return true;
         }
     }
     return false;
 }