| @@ 107-119 (lines=13) @@ | ||
| 104 | return $userId; |
|
| 105 | } |
|
| 106 | ||
| 107 | public function getVootToken($externalUserId) |
|
| 108 | { |
|
| 109 | $userId = $this->getUserId($externalUserId); |
|
| 110 | $stmt = $this->db->prepare( |
|
| 111 | 'SELECT voot_token |
|
| 112 | FROM voot_tokens |
|
| 113 | WHERE user_id = :user_id' |
|
| 114 | ); |
|
| 115 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 116 | $stmt->execute(); |
|
| 117 | ||
| 118 | return $stmt->fetchColumn(); |
|
| 119 | } |
|
| 120 | ||
| 121 | public function setVootToken($externalUserId, $vootToken) |
|
| 122 | { |
|
| @@ 135-147 (lines=13) @@ | ||
| 132 | return 1 === $stmt->rowCount(); |
|
| 133 | } |
|
| 134 | ||
| 135 | public function hasVootToken($externalUserId) |
|
| 136 | { |
|
| 137 | $userId = $this->getUserId($externalUserId); |
|
| 138 | $stmt = $this->db->prepare( |
|
| 139 | 'SELECT COUNT(*) |
|
| 140 | FROM voot_tokens |
|
| 141 | WHERE user_id = :user_id' |
|
| 142 | ); |
|
| 143 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 144 | $stmt->execute(); |
|
| 145 | ||
| 146 | return 1 === intval($stmt->fetchColumn()); |
|
| 147 | } |
|
| 148 | ||
| 149 | public function deleteVootToken($externalUserId) |
|
| 150 | { |
|
| @@ 149-160 (lines=12) @@ | ||
| 146 | return 1 === intval($stmt->fetchColumn()); |
|
| 147 | } |
|
| 148 | ||
| 149 | public function deleteVootToken($externalUserId) |
|
| 150 | { |
|
| 151 | $userId = $this->getUserId($externalUserId); |
|
| 152 | $stmt = $this->db->prepare( |
|
| 153 | 'DELETE FROM voot_tokens WHERE user_id = :user_id' |
|
| 154 | ); |
|
| 155 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 156 | ||
| 157 | $stmt->execute(); |
|
| 158 | ||
| 159 | return 1 === $stmt->rowCount(); |
|
| 160 | } |
|
| 161 | ||
| 162 | public function hasTotpSecret($externalUserId) |
|
| 163 | { |
|
| @@ 162-174 (lines=13) @@ | ||
| 159 | return 1 === $stmt->rowCount(); |
|
| 160 | } |
|
| 161 | ||
| 162 | public function hasTotpSecret($externalUserId) |
|
| 163 | { |
|
| 164 | $userId = $this->getUserId($externalUserId); |
|
| 165 | $stmt = $this->db->prepare( |
|
| 166 | 'SELECT COUNT(*) |
|
| 167 | FROM totp_secrets |
|
| 168 | WHERE user_id = :user_id' |
|
| 169 | ); |
|
| 170 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 171 | $stmt->execute(); |
|
| 172 | ||
| 173 | return 1 === intval($stmt->fetchColumn()); |
|
| 174 | } |
|
| 175 | ||
| 176 | public function getTotpSecret($externalUserId) |
|
| 177 | { |
|
| @@ 176-188 (lines=13) @@ | ||
| 173 | return 1 === intval($stmt->fetchColumn()); |
|
| 174 | } |
|
| 175 | ||
| 176 | public function getTotpSecret($externalUserId) |
|
| 177 | { |
|
| 178 | $userId = $this->getUserId($externalUserId); |
|
| 179 | $stmt = $this->db->prepare( |
|
| 180 | 'SELECT totp_secret |
|
| 181 | FROM totp_secrets |
|
| 182 | WHERE user_id = :user_id' |
|
| 183 | ); |
|
| 184 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 185 | $stmt->execute(); |
|
| 186 | ||
| 187 | return $stmt->fetchColumn(); |
|
| 188 | } |
|
| 189 | ||
| 190 | public function setTotpSecret($externalUserId, $totpSecret) |
|
| 191 | { |
|
| @@ 209-220 (lines=12) @@ | ||
| 206 | return true; |
|
| 207 | } |
|
| 208 | ||
| 209 | public function deleteTotpSecret($externalUserId) |
|
| 210 | { |
|
| 211 | $userId = $this->getUserId($externalUserId); |
|
| 212 | $stmt = $this->db->prepare( |
|
| 213 | 'DELETE FROM totp_secrets WHERE user_id = :user_id' |
|
| 214 | ); |
|
| 215 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 216 | ||
| 217 | $stmt->execute(); |
|
| 218 | ||
| 219 | return 1 === $stmt->rowCount(); |
|
| 220 | } |
|
| 221 | ||
| 222 | public function deleteUser($externalUserId) |
|
| 223 | { |
|
| @@ 328-339 (lines=12) @@ | ||
| 325 | return 1 === $stmt->rowCount(); |
|
| 326 | } |
|
| 327 | ||
| 328 | public function isDisabledUser($externalUserId) |
|
| 329 | { |
|
| 330 | $stmt = $this->db->prepare( |
|
| 331 | 'SELECT COUNT(*) |
|
| 332 | FROM users |
|
| 333 | WHERE external_user_id = :external_user_id AND is_disabled = 1' |
|
| 334 | ); |
|
| 335 | $stmt->bindValue(':external_user_id', $externalUserId, PDO::PARAM_STR); |
|
| 336 | $stmt->execute(); |
|
| 337 | ||
| 338 | return 1 === intval($stmt->fetchColumn()); |
|
| 339 | } |
|
| 340 | ||
| 341 | public function getAllLogEntries() |
|
| 342 | { |
|
| @@ 499-511 (lines=13) @@ | ||
| 496 | return $stmt->fetchColumn(); |
|
| 497 | } |
|
| 498 | ||
| 499 | public function setMotd($motdMessage) |
|
| 500 | { |
|
| 501 | $this->deleteMotd(); |
|
| 502 | ||
| 503 | $stmt = $this->db->prepare( |
|
| 504 | 'INSERT INTO motd (motd_message) VALUES(:motd_message)' |
|
| 505 | ); |
|
| 506 | ||
| 507 | $stmt->bindValue(':motd_message', $motdMessage, PDO::PARAM_STR); |
|
| 508 | $stmt->execute(); |
|
| 509 | ||
| 510 | return 1 === $stmt->rowCount(); |
|
| 511 | } |
|
| 512 | ||
| 513 | public function deleteMotd() |
|
| 514 | { |
|