Changeset View
Changeset View
Standalone View
Standalone View
src/applications/owners/storage/PhabricatorOwnersPackage.php
| Show All 21 Lines | final class PhabricatorOwnersPackage | ||||
| const STATUS_ACTIVE = 'active'; | const STATUS_ACTIVE = 'active'; | ||||
| const STATUS_ARCHIVED = 'archived'; | const STATUS_ARCHIVED = 'archived'; | ||||
| public static function initializeNewPackage(PhabricatorUser $actor) { | public static function initializeNewPackage(PhabricatorUser $actor) { | ||||
| return id(new PhabricatorOwnersPackage()) | return id(new PhabricatorOwnersPackage()) | ||||
| ->setAuditingEnabled(0) | ->setAuditingEnabled(0) | ||||
| ->attachPaths(array()) | ->attachPaths(array()) | ||||
| ->setStatus(self::STATUS_ACTIVE) | ->setStatus(self::STATUS_ACTIVE) | ||||
| ->attachOwners(array()); | ->attachOwners(array()) | ||||
| } | ->setDescription(''); | ||||
| public function getCapabilities() { | |||||
| return array( | |||||
| PhabricatorPolicyCapability::CAN_VIEW, | |||||
| ); | |||||
| } | |||||
| public function getPolicy($capability) { | |||||
| return PhabricatorPolicies::POLICY_USER; | |||||
| } | |||||
| public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | |||||
| return false; | |||||
| } | |||||
| public function describeAutomaticCapability($capability) { | |||||
| return null; | |||||
| } | } | ||||
| public static function getStatusNameMap() { | public static function getStatusNameMap() { | ||||
| return array( | return array( | ||||
| self::STATUS_ACTIVE => pht('Active'), | self::STATUS_ACTIVE => pht('Active'), | ||||
| self::STATUS_ARCHIVED => pht('Archived'), | self::STATUS_ARCHIVED => pht('Archived'), | ||||
| ); | ); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | public function attachOwners(array $owners) { | ||||
| $this->owners = $owners; | $this->owners = $owners; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getOwners() { | public function getOwners() { | ||||
| return $this->assertAttached($this->owners); | return $this->assertAttached($this->owners); | ||||
| } | } | ||||
| public function getOwnerPHIDs() { | |||||
| return mpull($this->getOwners(), 'getUserPHID'); | |||||
| } | |||||
| /* -( PhabricatorPolicyInterface )----------------------------------------- */ | |||||
| public function getCapabilities() { | |||||
| return array( | |||||
| PhabricatorPolicyCapability::CAN_VIEW, | |||||
| PhabricatorPolicyCapability::CAN_EDIT, | |||||
| ); | |||||
| } | |||||
| public function getPolicy($capability) { | |||||
| // TODO: Implement proper policies. | |||||
| return PhabricatorPolicies::POLICY_USER; | |||||
| } | |||||
| public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | |||||
| return false; | |||||
| } | |||||
| public function describeAutomaticCapability($capability) { | |||||
| return null; | |||||
| } | |||||
| /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
| public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
| return new PhabricatorOwnersPackageTransactionEditor(); | return new PhabricatorOwnersPackageTransactionEditor(); | ||||
| } | } | ||||
| Show All 36 Lines | |||||