Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/auth/query/PhabricatorExternalAccountIdentifierQuery.php
12256 views
1
<?php
2
3
final class PhabricatorExternalAccountIdentifierQuery
4
extends PhabricatorCursorPagedPolicyAwareQuery {
5
6
private $ids;
7
private $phids;
8
private $providerConfigPHIDs;
9
private $externalAccountPHIDs;
10
private $rawIdentifiers;
11
12
public function withIDs($ids) {
13
$this->ids = $ids;
14
return $this;
15
}
16
17
public function withPHIDs(array $phids) {
18
$this->phids = $phids;
19
return $this;
20
}
21
22
public function withProviderConfigPHIDs(array $phids) {
23
$this->providerConfigPHIDs = $phids;
24
return $this;
25
}
26
27
public function withExternalAccountPHIDs(array $phids) {
28
$this->externalAccountPHIDs = $phids;
29
return $this;
30
}
31
32
public function withRawIdentifiers(array $identifiers) {
33
$this->rawIdentifiers = $identifiers;
34
return $this;
35
}
36
37
public function newResultObject() {
38
return new PhabricatorExternalAccountIdentifier();
39
}
40
41
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
42
$where = parent::buildWhereClauseParts($conn);
43
44
if ($this->ids !== null) {
45
$where[] = qsprintf(
46
$conn,
47
'id IN (%Ld)',
48
$this->ids);
49
}
50
51
if ($this->phids !== null) {
52
$where[] = qsprintf(
53
$conn,
54
'phid IN (%Ls)',
55
$this->phids);
56
}
57
58
if ($this->providerConfigPHIDs !== null) {
59
$where[] = qsprintf(
60
$conn,
61
'providerConfigPHID IN (%Ls)',
62
$this->providerConfigPHIDs);
63
}
64
65
if ($this->externalAccountPHIDs !== null) {
66
$where[] = qsprintf(
67
$conn,
68
'externalAccountPHID IN (%Ls)',
69
$this->externalAccountPHIDs);
70
}
71
72
if ($this->rawIdentifiers !== null) {
73
$hashes = array();
74
foreach ($this->rawIdentifiers as $raw_identifier) {
75
$hashes[] = PhabricatorHash::digestForIndex($raw_identifier);
76
}
77
$where[] = qsprintf(
78
$conn,
79
'identifierHash IN (%Ls)',
80
$hashes);
81
}
82
83
return $where;
84
}
85
86
public function getQueryApplicationClass() {
87
return 'PhabricatorPeopleApplication';
88
}
89
90
}
91
92