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