Exemplo n.º 1
0
 /**
  * Delete the user from the database
  *
  * @param LTI_User $user
  * @return bool
  */
 public function User_delete($user)
 {
     $key = $user->getResourceLink()->getKey();
     $id = $user->getResourceLink()->getId();
     $userId = $user->getId(LTI_Tool_Provider::ID_SCOPE_ID_ONLY);
     $sql = 'DELETE FROM ' . $this->dbTableNamePrefix . LTI_Data_Connector::USER_TABLE_NAME . ' ' . 'WHERE (consumer_key = :key) AND (context_id = :id) AND (user_id = :user_id)';
     $query = $this->db->prepare($sql);
     $query->bindValue('key', $key, PDO::PARAM_STR);
     $query->bindValue('id', $id, PDO::PARAM_STR);
     $query->bindValue('user_id', $userId, PDO::PARAM_STR);
     $ok = $query->execute();
     if ($ok) {
         $user->initialise();
     }
     return $ok;
 }