| @@ 110-122 (lines=13) @@ | ||
| 107 | return $userId; |
|
| 108 | } |
|
| 109 | ||
| 110 | public function getVootToken($externalUserId) |
|
| 111 | { |
|
| 112 | $userId = $this->getUserId($externalUserId); |
|
| 113 | $stmt = $this->db->prepare( |
|
| 114 | 'SELECT voot_token |
|
| 115 | FROM voot_tokens |
|
| 116 | WHERE user_id = :user_id' |
|
| 117 | ); |
|
| 118 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 119 | $stmt->execute(); |
|
| 120 | ||
| 121 | return $stmt->fetchColumn(); |
|
| 122 | } |
|
| 123 | ||
| 124 | public function setVootToken($externalUserId, $vootToken) |
|
| 125 | { |
|
| @@ 138-150 (lines=13) @@ | ||
| 135 | return 1 === $stmt->rowCount(); |
|
| 136 | } |
|
| 137 | ||
| 138 | public function hasVootToken($externalUserId) |
|
| 139 | { |
|
| 140 | $userId = $this->getUserId($externalUserId); |
|
| 141 | $stmt = $this->db->prepare( |
|
| 142 | 'SELECT COUNT(*) |
|
| 143 | FROM voot_tokens |
|
| 144 | WHERE user_id = :user_id' |
|
| 145 | ); |
|
| 146 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 147 | $stmt->execute(); |
|
| 148 | ||
| 149 | return 1 === intval($stmt->fetchColumn()); |
|
| 150 | } |
|
| 151 | ||
| 152 | public function deleteVootToken($externalUserId) |
|
| 153 | { |
|
| @@ 152-163 (lines=12) @@ | ||
| 149 | return 1 === intval($stmt->fetchColumn()); |
|
| 150 | } |
|
| 151 | ||
| 152 | public function deleteVootToken($externalUserId) |
|
| 153 | { |
|
| 154 | $userId = $this->getUserId($externalUserId); |
|
| 155 | $stmt = $this->db->prepare( |
|
| 156 | 'DELETE FROM voot_tokens WHERE user_id = :user_id' |
|
| 157 | ); |
|
| 158 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 159 | ||
| 160 | $stmt->execute(); |
|
| 161 | ||
| 162 | return 1 === $stmt->rowCount(); |
|
| 163 | } |
|
| 164 | ||
| 165 | public function hasTotpSecret($externalUserId) |
|
| 166 | { |
|
| @@ 165-177 (lines=13) @@ | ||
| 162 | return 1 === $stmt->rowCount(); |
|
| 163 | } |
|
| 164 | ||
| 165 | public function hasTotpSecret($externalUserId) |
|
| 166 | { |
|
| 167 | $userId = $this->getUserId($externalUserId); |
|
| 168 | $stmt = $this->db->prepare( |
|
| 169 | 'SELECT COUNT(*) |
|
| 170 | FROM totp_secrets |
|
| 171 | WHERE user_id = :user_id' |
|
| 172 | ); |
|
| 173 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 174 | $stmt->execute(); |
|
| 175 | ||
| 176 | return 1 === intval($stmt->fetchColumn()); |
|
| 177 | } |
|
| 178 | ||
| 179 | public function getTotpSecret($externalUserId) |
|
| 180 | { |
|
| @@ 179-191 (lines=13) @@ | ||
| 176 | return 1 === intval($stmt->fetchColumn()); |
|
| 177 | } |
|
| 178 | ||
| 179 | public function getTotpSecret($externalUserId) |
|
| 180 | { |
|
| 181 | $userId = $this->getUserId($externalUserId); |
|
| 182 | $stmt = $this->db->prepare( |
|
| 183 | 'SELECT totp_secret |
|
| 184 | FROM totp_secrets |
|
| 185 | WHERE user_id = :user_id' |
|
| 186 | ); |
|
| 187 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 188 | $stmt->execute(); |
|
| 189 | ||
| 190 | return $stmt->fetchColumn(); |
|
| 191 | } |
|
| 192 | ||
| 193 | public function setTotpSecret($externalUserId, $totpSecret) |
|
| 194 | { |
|
| @@ 212-223 (lines=12) @@ | ||
| 209 | return true; |
|
| 210 | } |
|
| 211 | ||
| 212 | public function deleteTotpSecret($externalUserId) |
|
| 213 | { |
|
| 214 | $userId = $this->getUserId($externalUserId); |
|
| 215 | $stmt = $this->db->prepare( |
|
| 216 | 'DELETE FROM totp_secrets WHERE user_id = :user_id' |
|
| 217 | ); |
|
| 218 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 219 | ||
| 220 | $stmt->execute(); |
|
| 221 | ||
| 222 | return 1 === $stmt->rowCount(); |
|
| 223 | } |
|
| 224 | ||
| 225 | public function deleteUser($externalUserId) |
|
| 226 | { |
|
| @@ 343-354 (lines=12) @@ | ||
| 340 | return 1 === $stmt->rowCount(); |
|
| 341 | } |
|
| 342 | ||
| 343 | public function isDisabledUser($externalUserId) |
|
| 344 | { |
|
| 345 | $stmt = $this->db->prepare( |
|
| 346 | 'SELECT COUNT(*) |
|
| 347 | FROM users |
|
| 348 | WHERE external_user_id = :external_user_id AND is_disabled = 1' |
|
| 349 | ); |
|
| 350 | $stmt->bindValue(':external_user_id', $externalUserId, PDO::PARAM_STR); |
|
| 351 | $stmt->execute(); |
|
| 352 | ||
| 353 | return 1 === intval($stmt->fetchColumn()); |
|
| 354 | } |
|
| 355 | ||
| 356 | public function getAllLogEntries() |
|
| 357 | { |
|
| @@ 521-533 (lines=13) @@ | ||
| 518 | return $stmt->fetchColumn(); |
|
| 519 | } |
|
| 520 | ||
| 521 | public function setMotd($motdMessage) |
|
| 522 | { |
|
| 523 | $this->deleteMotd(); |
|
| 524 | ||
| 525 | $stmt = $this->db->prepare( |
|
| 526 | 'INSERT INTO motd (motd_message) VALUES(:motd_message)' |
|
| 527 | ); |
|
| 528 | ||
| 529 | $stmt->bindValue(':motd_message', $motdMessage, PDO::PARAM_STR); |
|
| 530 | $stmt->execute(); |
|
| 531 | ||
| 532 | return 1 === $stmt->rowCount(); |
|
| 533 | } |
|
| 534 | ||
| 535 | public function deleteMotd() |
|
| 536 | { |
|