function getAuthority($data_id)
 {
     $data_id = (int) $data_id;
     $fileData = new FileData($data_id, $GLOBALS['connection'], DB_NAME);
     if ($this->user_obj->isAdmin() || $this->user_obj->isReviewerForFile($data_id)) {
         return $this->ADMIN_RIGHT;
     }
     if ($fileData->isOwner($this->uid) && $fileData->isLocked()) {
         return $this->WRITE_RIGHT;
     }
     $uperm = $this->userperm_obj->getPermission($data_id);
     $dperm = $this->deptperm_obj->getPermission($data_id);
     if ($uperm >= $this->userperm_obj->NONE_RIGHT and $uperm <= $this->userperm_obj->ADMIN_RIGHT) {
         return $uperm;
     } else {
         return $dperm;
     }
 }
示例#2
0
 /**
  * getAuthority
  * Return the authority that this user have on file data_id
  * by combining and prioritizing user and department right
  * @param int $data_id
  * @return int
  */
 public function getAuthority($data_id)
 {
     $data_id = (int) $data_id;
     $fileData = new FileData($data_id, $this->connection);
     if ($this->user_obj->isAdmin() || $this->user_obj->isReviewerForFile($data_id)) {
         return $this->ADMIN_RIGHT;
     }
     if ($fileData->isOwner($this->uid) && $fileData->isLocked()) {
         return $this->WRITE_RIGHT;
     }
     $user_permissions = $this->user_perms_obj->getPermission($data_id);
     $department_permissions = $this->dept_perms_obj->getPermission($data_id);
     if ($user_permissions >= $this->user_perms_obj->NONE_RIGHT and $user_permissions <= $this->user_perms_obj->ADMIN_RIGHT) {
         return $user_permissions;
     } else {
         return $department_permissions;
     }
 }
示例#3
0
 /**
  * return whether if this user can admin $data_id
  * @param $data_id
  * @return bool
  */
 function canAdmin($data_id)
 {
     $filedata = new FileData($data_id, $this->connection);
     if (!$this->isForbidden($data_id) or !$filedata->isPublishable()) {
         if ($this->canUser($data_id, $this->ADMIN_RIGHT) or $this->dept_perms_obj->canAdmin($data_id) or $filedata->isOwner($this->id)) {
             return true;
         } else {
             false;
         }
     }
 }