| @@ 103-118 (lines=16) @@ | ||
| 100 | return $userList; |
|
| 101 | } |
|
| 102 | ||
| 103 | public function getUserCertificateInfo($commonName) |
|
| 104 | { |
|
| 105 | $stmt = $this->db->prepare( |
|
| 106 | <<< 'SQL' |
|
| 107 | SELECT |
|
| 108 | u.user_id AS user_id, |
|
| 109 | u.is_disabled AS user_is_disabled, |
|
| 110 | c.display_name AS display_name, |
|
| 111 | c.is_disabled AS certificate_is_disabled |
|
| 112 | FROM |
|
| 113 | users u, certificates c |
|
| 114 | WHERE |
|
| 115 | u.id = c.user_id AND |
|
| 116 | c.common_name = :common_name |
|
| 117 | SQL |
|
| 118 | ); |
|
| 119 | ||
| 120 | $stmt->bindValue(':common_name', $commonName, PDO::PARAM_STR); |
|
| 121 | $stmt->execute(); |
|
| @@ 357-367 (lines=11) @@ | ||
| 354 | return $certificateList; |
|
| 355 | } |
|
| 356 | ||
| 357 | public function disableCertificate($commonName) |
|
| 358 | { |
|
| 359 | $stmt = $this->db->prepare( |
|
| 360 | <<< 'SQL' |
|
| 361 | UPDATE |
|
| 362 | certificates |
|
| 363 | SET |
|
| 364 | is_disabled = 1 |
|
| 365 | WHERE |
|
| 366 | common_name = :common_name |
|
| 367 | SQL |
|
| 368 | ); |
|
| 369 | $stmt->bindValue(':common_name', $commonName, PDO::PARAM_STR); |
|
| 370 | ||
| @@ 376-386 (lines=11) @@ | ||
| 373 | return 1 === $stmt->rowCount(); |
|
| 374 | } |
|
| 375 | ||
| 376 | public function deleteCertificate($commonName) |
|
| 377 | { |
|
| 378 | $stmt = $this->db->prepare( |
|
| 379 | <<< 'SQL' |
|
| 380 | DELETE FROM |
|
| 381 | certificates |
|
| 382 | WHERE |
|
| 383 | common_name = :common_name |
|
| 384 | SQL |
|
| 385 | ); |
|
| 386 | $stmt->bindValue(':common_name', $commonName, PDO::PARAM_STR); |
|
| 387 | ||
| 388 | $stmt->execute(); |
|
| 389 | // XXX |
|
| @@ 393-403 (lines=11) @@ | ||
| 390 | return 1 === $stmt->rowCount(); |
|
| 391 | } |
|
| 392 | ||
| 393 | public function enableCertificate($commonName) |
|
| 394 | { |
|
| 395 | $stmt = $this->db->prepare( |
|
| 396 | <<< 'SQL' |
|
| 397 | UPDATE |
|
| 398 | certificates |
|
| 399 | SET |
|
| 400 | is_disabled = 0 |
|
| 401 | WHERE |
|
| 402 | common_name = :common_name |
|
| 403 | SQL |
|
| 404 | ); |
|
| 405 | $stmt->bindValue(':common_name', $commonName, PDO::PARAM_STR); |
|
| 406 | ||
| @@ 585-600 (lines=16) @@ | ||
| 582 | return 1 === $stmt->rowCount(); |
|
| 583 | } |
|
| 584 | ||
| 585 | public function getLogEntry($dateTimeUnix, $ipAddress) |
|
| 586 | { |
|
| 587 | $stmt = $this->db->prepare( |
|
| 588 | <<< 'SQL' |
|
| 589 | SELECT |
|
| 590 | user_id, |
|
| 591 | profile_id, |
|
| 592 | common_name, |
|
| 593 | ip4, |
|
| 594 | ip6, |
|
| 595 | connected_at, |
|
| 596 | disconnected_at |
|
| 597 | FROM |
|
| 598 | connection_log |
|
| 599 | WHERE |
|
| 600 | (ip4 = :ip_address OR ip6 = :ip_address) |
|
| 601 | AND |
|
| 602 | connected_at < :date_time_unix |
|
| 603 | AND |
|