/**
  * @return Operation
  */
 public function operation()
 {
     return Operation::instance($this->preferences, $this->mysql->getHandler());
 }
예제 #2
0
 public function removeUserFromRole($userId, $roleId)
 {
     if (User::instance($this->preferences, $this->db)->findById($userId) && Role::instance($this->preferences, $this->db)->findById($roleId)) {
         try {
             $sql = "DELETE FROM rpd_user_has_role WHERE id_user = :userId AND id_role = :roleId";
             $stmt = $this->db->prepare($sql);
             $stmt->bindParam(':userId', $userId, PDO::PARAM_INT);
             $stmt->bindParam(':roleId', $roleId, PDO::PARAM_INT);
             return $stmt->execute();
         } catch (\PDOException $e) {
             MySQL::instance()->showException($e);
         }
     }
     return false;
 }
예제 #3
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;
 }
예제 #4
0
 public function removeUsersFromRole($roleId)
 {
     if (Role::instance($this->preferences, $this->db)->findById($roleId)) {
         try {
             $sql = "DELETE FROM rpd_user_has_role WHERE id_role = :idRole";
             $stmt = $this->db->prepare($sql);
             $this->id = (int) $roleId;
             $stmt->bindParam(':idRole', $this->id, PDO::PARAM_INT);
             return $stmt->execute();
         } catch (\PDOException $e) {
             MySQL::instance()->showException($e);
         }
     }
     return false;
 }