Path: blob/master/src/applications/auth/query/PhabricatorAuthTemporaryTokenQuery.php
12256 views
<?php12final class PhabricatorAuthTemporaryTokenQuery3extends PhabricatorCursorPagedPolicyAwareQuery {45private $ids;6private $tokenResources;7private $tokenTypes;8private $userPHIDs;9private $expired;10private $tokenCodes;1112public function withIDs(array $ids) {13$this->ids = $ids;14return $this;15}1617public function withTokenResources(array $resources) {18$this->tokenResources = $resources;19return $this;20}2122public function withTokenTypes(array $types) {23$this->tokenTypes = $types;24return $this;25}2627public function withExpired($expired) {28$this->expired = $expired;29return $this;30}3132public function withTokenCodes(array $codes) {33$this->tokenCodes = $codes;34return $this;35}3637public function withUserPHIDs(array $phids) {38$this->userPHIDs = $phids;39return $this;40}4142public function newResultObject() {43return new PhabricatorAuthTemporaryToken();44}4546protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {47$where = parent::buildWhereClauseParts($conn);4849if ($this->ids !== null) {50$where[] = qsprintf(51$conn,52'id IN (%Ld)',53$this->ids);54}5556if ($this->tokenResources !== null) {57$where[] = qsprintf(58$conn,59'tokenResource IN (%Ls)',60$this->tokenResources);61}6263if ($this->tokenTypes !== null) {64$where[] = qsprintf(65$conn,66'tokenType IN (%Ls)',67$this->tokenTypes);68}6970if ($this->expired !== null) {71if ($this->expired) {72$where[] = qsprintf(73$conn,74'tokenExpires <= %d',75time());76} else {77$where[] = qsprintf(78$conn,79'tokenExpires > %d',80time());81}82}8384if ($this->tokenCodes !== null) {85$where[] = qsprintf(86$conn,87'tokenCode IN (%Ls)',88$this->tokenCodes);89}9091if ($this->userPHIDs !== null) {92$where[] = qsprintf(93$conn,94'userPHID IN (%Ls)',95$this->userPHIDs);96}9798return $where;99}100101public function getQueryApplicationClass() {102return 'PhabricatorAuthApplication';103}104105}106107108