Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/query/PhabricatorAuthSSHKeyQuery.php
| <?php | <?php | ||||
| final class PhabricatorAuthSSHKeyQuery | final class PhabricatorAuthSSHKeyQuery | ||||
| extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
| private $ids; | private $ids; | ||||
| private $phids; | private $phids; | ||||
| private $objectPHIDs; | private $objectPHIDs; | ||||
| private $keys; | private $keys; | ||||
| private $isActive; | |||||
| public function withIDs(array $ids) { | public function withIDs(array $ids) { | ||||
| $this->ids = $ids; | $this->ids = $ids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withPHIDs(array $phids) { | public function withPHIDs(array $phids) { | ||||
| $this->phids = $phids; | $this->phids = $phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withObjectPHIDs(array $object_phids) { | public function withObjectPHIDs(array $object_phids) { | ||||
| $this->objectPHIDs = $object_phids; | $this->objectPHIDs = $object_phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withKeys(array $keys) { | public function withKeys(array $keys) { | ||||
| assert_instances_of($keys, 'PhabricatorAuthSSHPublicKey'); | assert_instances_of($keys, 'PhabricatorAuthSSHPublicKey'); | ||||
| $this->keys = $keys; | $this->keys = $keys; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withIsActive($active) { | |||||
| $this->isActive = $active; | |||||
| return $this; | |||||
| } | |||||
| public function newResultObject() { | public function newResultObject() { | ||||
| return new PhabricatorAuthSSHKey(); | return new PhabricatorAuthSSHKey(); | ||||
| } | } | ||||
| protected function loadPage() { | protected function loadPage() { | ||||
| return $this->loadStandardPage($this->newResultObject()); | return $this->loadStandardPage($this->newResultObject()); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | if ($this->keys !== null) { | ||||
| $conn, | $conn, | ||||
| '(keyType = %s AND keyIndex = %s)', | '(keyType = %s AND keyIndex = %s)', | ||||
| $key->getType(), | $key->getType(), | ||||
| $key->getHash()); | $key->getHash()); | ||||
| } | } | ||||
| $where[] = implode(' OR ', $sql); | $where[] = implode(' OR ', $sql); | ||||
| } | } | ||||
| if ($this->isActive !== null) { | |||||
| if ($this->isActive) { | |||||
| $where[] = qsprintf( | |||||
| $conn, | |||||
| 'isActive = %d', | |||||
| 1); | |||||
| } else { | |||||
| $where[] = qsprintf( | |||||
| $conn, | |||||
| 'isActive IS NULL'); | |||||
| } | |||||
| } | |||||
| return $where; | return $where; | ||||
| } | } | ||||
| public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
| return 'PhabricatorAuthApplication'; | return 'PhabricatorAuthApplication'; | ||||
| } | } | ||||
| } | } | ||||