[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/search/storage/ -> PhabricatorNamedQuery.php (source)

   1  <?php
   2  
   3  final class PhabricatorNamedQuery extends PhabricatorSearchDAO
   4    implements PhabricatorPolicyInterface {
   5  
   6    protected $queryKey;
   7    protected $queryName;
   8    protected $userPHID;
   9    protected $engineClassName;
  10  
  11    protected $isBuiltin  = 0;
  12    protected $isDisabled = 0;
  13    protected $sequence   = 0;
  14  
  15    public function getConfiguration() {
  16      return array(
  17        self::CONFIG_COLUMN_SCHEMA => array(
  18          'engineClassName' => 'text128',
  19          'queryName' => 'text255',
  20          'queryKey' => 'text12',
  21          'isBuiltin' => 'bool',
  22          'isDisabled' => 'bool',
  23          'sequence' => 'uint32',
  24        ),
  25        self::CONFIG_KEY_SCHEMA => array(
  26          'key_userquery' => array(
  27            'columns' => array('userPHID', 'engineClassName', 'queryKey'),
  28            'unique' => true,
  29          ),
  30        ),
  31      ) + parent::getConfiguration();
  32    }
  33  
  34    public function getSortKey() {
  35      return sprintf('~%010d%010d', $this->sequence, $this->getID());
  36    }
  37  
  38  /* -(  PhabricatorPolicyInterface  )----------------------------------------- */
  39  
  40  
  41    public function getCapabilities() {
  42      return array(
  43        PhabricatorPolicyCapability::CAN_VIEW,
  44      );
  45    }
  46  
  47    public function getPolicy($capability) {
  48      return PhabricatorPolicies::POLICY_NOONE;
  49    }
  50  
  51    public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
  52      if ($viewer->getPHID() == $this->userPHID) {
  53        return true;
  54      }
  55      return false;
  56    }
  57  
  58    public function describeAutomaticCapability($capability) {
  59      return pht(
  60        'The queries you have saved are private. Only you can view or edit '.
  61        'them.');
  62    }
  63  
  64  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1