[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DrydockLog extends DrydockDAO 4 implements PhabricatorPolicyInterface { 5 6 protected $resourceID; 7 protected $leaseID; 8 protected $epoch; 9 protected $message; 10 11 private $resource = self::ATTACHABLE; 12 private $lease = self::ATTACHABLE; 13 14 public function getConfiguration() { 15 return array( 16 self::CONFIG_TIMESTAMPS => false, 17 self::CONFIG_COLUMN_SCHEMA => array( 18 'resourceID' => 'id?', 19 'leaseID' => 'id?', 20 'message' => 'text', 21 ), 22 self::CONFIG_KEY_SCHEMA => array( 23 'resourceID' => array( 24 'columns' => array('resourceID', 'epoch'), 25 ), 26 'leaseID' => array( 27 'columns' => array('leaseID', 'epoch'), 28 ), 29 'epoch' => array( 30 'columns' => array('epoch'), 31 ), 32 ), 33 ) + parent::getConfiguration(); 34 } 35 36 public function attachResource(DrydockResource $resource = null) { 37 $this->resource = $resource; 38 return $this; 39 } 40 41 public function getResource() { 42 return $this->assertAttached($this->resource); 43 } 44 45 public function attachLease(DrydockLease $lease = null) { 46 $this->lease = $lease; 47 return $this; 48 } 49 50 public function getLease() { 51 return $this->assertAttached($this->lease); 52 } 53 54 55 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 56 57 58 public function getCapabilities() { 59 return array( 60 PhabricatorPolicyCapability::CAN_VIEW, 61 ); 62 } 63 64 public function getPolicy($capability) { 65 if ($this->getResource()) { 66 return $this->getResource()->getPolicy($capability); 67 } 68 return $this->getLease()->getPolicy($capability); 69 } 70 71 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 72 if ($this->getResource()) { 73 return $this->getResource()->hasAutomaticCapability($capability, $viewer); 74 } 75 return $this->getLease()->hasAutomaticCapability($capability, $viewer); 76 } 77 78 public function describeAutomaticCapability($capability) { 79 return pht('Logs inherit the policy of their resources.'); 80 } 81 82 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |