Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/auth/query/PhabricatorAuthChallengeQuery.php
12262 views
1
<?php
2
3
final class PhabricatorAuthChallengeQuery
4
extends PhabricatorCursorPagedPolicyAwareQuery {
5
6
private $ids;
7
private $phids;
8
private $userPHIDs;
9
private $factorPHIDs;
10
private $challengeTTLMin;
11
private $challengeTTLMax;
12
13
public function withIDs(array $ids) {
14
$this->ids = $ids;
15
return $this;
16
}
17
18
public function withPHIDs(array $phids) {
19
$this->phids = $phids;
20
return $this;
21
}
22
23
public function withUserPHIDs(array $user_phids) {
24
$this->userPHIDs = $user_phids;
25
return $this;
26
}
27
28
public function withFactorPHIDs(array $factor_phids) {
29
$this->factorPHIDs = $factor_phids;
30
return $this;
31
}
32
33
public function withChallengeTTLBetween($challenge_min, $challenge_max) {
34
$this->challengeTTLMin = $challenge_min;
35
$this->challengeTTLMax = $challenge_max;
36
return $this;
37
}
38
39
public function newResultObject() {
40
return new PhabricatorAuthChallenge();
41
}
42
43
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
44
$where = parent::buildWhereClauseParts($conn);
45
46
if ($this->ids !== null) {
47
$where[] = qsprintf(
48
$conn,
49
'id IN (%Ld)',
50
$this->ids);
51
}
52
53
if ($this->phids !== null) {
54
$where[] = qsprintf(
55
$conn,
56
'phid IN (%Ls)',
57
$this->phids);
58
}
59
60
if ($this->userPHIDs !== null) {
61
$where[] = qsprintf(
62
$conn,
63
'userPHID IN (%Ls)',
64
$this->userPHIDs);
65
}
66
67
if ($this->factorPHIDs !== null) {
68
$where[] = qsprintf(
69
$conn,
70
'factorPHID IN (%Ls)',
71
$this->factorPHIDs);
72
}
73
74
if ($this->challengeTTLMin !== null) {
75
$where[] = qsprintf(
76
$conn,
77
'challengeTTL >= %d',
78
$this->challengeTTLMin);
79
}
80
81
if ($this->challengeTTLMax !== null) {
82
$where[] = qsprintf(
83
$conn,
84
'challengeTTL <= %d',
85
$this->challengeTTLMax);
86
}
87
88
return $where;
89
}
90
91
public function getQueryApplicationClass() {
92
return 'PhabricatorAuthApplication';
93
}
94
95
}
96
97