コード例 #1
0
 /**
  * @return Task
  */
 public function task()
 {
     return Task::instance($this->preferences, $this->mysql->getHandler());
 }
コード例 #2
0
 public function removeOperationFromTask($operationId, $taskId)
 {
     if (Task::instance($this->preferences, $this->db)->findById($taskId) && Operation::instance($this->preferences, $this->db)->findById($operationId)) {
         try {
             $sql = "DELETE FROM rpd_task_has_operation WHERE id_task = :taskId AND id_operation = :operationId";
             $stmt = $this->db->prepare($sql);
             $stmt->bindParam(':taskId', $taskId, PDO::PARAM_INT);
             $stmt->bindParam(':operationId', $operationId, PDO::PARAM_INT);
             return $stmt->execute();
         } catch (\PDOException $e) {
             MySQL::instance()->showException($e);
         }
     }
     return false;
 }
コード例 #3
0
ファイル: Role.php プロジェクト: maykonn/rapid-authorization
 public function hasAccessToTask($taskId, $roleId)
 {
     if (Task::instance($this->preferences, $this->db)->findById($taskId) && Role::instance($this->preferences, $this->db)->findById($roleId)) {
         try {
             $sql = "SELECT id FROM rpd_role_has_task WHERE id_role = :idRole AND id_task = :idTask";
             $stmt = $this->db->prepare($sql);
             $this->id = (int) $roleId;
             $stmt->bindParam(':idRole', $this->id, PDO::PARAM_INT);
             $stmt->bindParam(':idTask', $taskId, PDO::PARAM_INT);
             $stmt->execute();
             return $stmt->fetch() ? true : false;
         } catch (\PDOException $e) {
             MySQL::instance()->showException($e);
         }
     }
     return false;
 }
コード例 #4
0
ファイル: User.php プロジェクト: maykonn/rapid-authorization
 public function hasAccessToOperation($taskId, $operationId, $userId)
 {
     if (User::instance($this->preferences, $this->db)->hasAccessToTask($taskId, $userId) && Task::instance($this->preferences, $this->db)->hasOperation($operationId, $taskId)) {
         $tasksThatCanExecuteTheOperation = Operation::instance($this->preferences, $this->db)->getTasksThatCanExecute($operationId);
         foreach ($tasksThatCanExecuteTheOperation as $task) {
             if ($this->hasAccessToTask($task['id_task'], $userId)) {
                 return true;
             }
         }
     }
     return false;
 }
コード例 #5
0
ファイル: Task.php プロジェクト: maykonn/rapid-authorization
 public function removeTaskFromRole($taskId, $roleId)
 {
     if (Role::instance($this->preferences, $this->db)->findById($roleId) && Task::instance($this->preferences, $this->db)->findById($taskId)) {
         try {
             $sql = "DELETE FROM rpd_role_has_task WHERE id_role = :roleId AND id_task = :taskId";
             $stmt = $this->db->prepare($sql);
             $stmt->bindParam(':roleId', $roleId, PDO::PARAM_INT);
             $stmt->bindParam(':taskId', $taskId, PDO::PARAM_INT);
             return $stmt->execute();
         } catch (\PDOException $e) {
             MySQL::instance()->showException($e);
         }
     }
     return false;
 }