3 final class PhabricatorAuthPasswordQuery
4 extends PhabricatorCursorPagedPolicyAwareQuery
{
9 private $passwordTypes;
12 public function withIDs(array $ids) {
17 public function withPHIDs(array $phids) {
18 $this->phids
= $phids;
22 public function withObjectPHIDs(array $object_phids) {
23 $this->objectPHIDs
= $object_phids;
27 public function withPasswordTypes(array $types) {
28 $this->passwordTypes
= $types;
32 public function withIsRevoked($is_revoked) {
33 $this->isRevoked
= $is_revoked;
37 public function newResultObject() {
38 return new PhabricatorAuthPassword();
41 protected function loadPage() {
42 return $this->loadStandardPage($this->newResultObject());
45 protected function buildWhereClauseParts(AphrontDatabaseConnection
$conn) {
46 $where = parent
::buildWhereClauseParts($conn);
48 if ($this->ids
!== null) {
55 if ($this->phids
!== null) {
62 if ($this->objectPHIDs
!== null) {
65 'objectPHID IN (%Ls)',
69 if ($this->passwordTypes
!== null) {
72 'passwordType IN (%Ls)',
73 $this->passwordTypes
);
76 if ($this->isRevoked
!== null) {
80 (int)$this->isRevoked
);
86 protected function willFilterPage(array $passwords) {
87 $object_phids = mpull($passwords, 'getObjectPHID');
89 $objects = id(new PhabricatorObjectQuery())
90 ->setViewer($this->getViewer())
91 ->setParentQuery($this)
92 ->withPHIDs($object_phids)
94 $objects = mpull($objects, null, 'getPHID');
96 foreach ($passwords as $key => $password) {
97 $object = idx($objects, $password->getObjectPHID());
99 unset($passwords[$key]);
100 $this->didRejectResult($password);
104 $password->attachObject($object);
110 public function getQueryApplicationClass() {
111 return 'PhabricatorAuthApplication';