Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/storage/AlmanacDevice.php
<?php | <?php | ||||
final class AlmanacDevice | final class AlmanacDevice | ||||
extends AlmanacDAO | extends AlmanacDAO | ||||
implements | implements | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
PhabricatorCustomFieldInterface, | |||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorProjectInterface, | PhabricatorProjectInterface, | ||||
PhabricatorSSHPublicKeyInterface, | PhabricatorSSHPublicKeyInterface, | ||||
AlmanacPropertyInterface, | AlmanacPropertyInterface, | ||||
PhabricatorDestructibleInterface, | PhabricatorDestructibleInterface, | ||||
PhabricatorNgramsInterface { | PhabricatorNgramsInterface { | ||||
protected $name; | protected $name; | ||||
protected $nameIndex; | protected $nameIndex; | ||||
protected $mailKey; | protected $mailKey; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
protected $isLocked; | protected $isLocked; | ||||
private $customFields = self::ATTACHABLE; | |||||
private $almanacProperties = self::ATTACHABLE; | private $almanacProperties = self::ATTACHABLE; | ||||
public static function initializeNewDevice() { | public static function initializeNewDevice() { | ||||
return id(new AlmanacDevice()) | return id(new AlmanacDevice()) | ||||
->setViewPolicy(PhabricatorPolicies::POLICY_USER) | ->setViewPolicy(PhabricatorPolicies::POLICY_USER) | ||||
->setEditPolicy(PhabricatorPolicies::POLICY_ADMIN) | ->setEditPolicy(PhabricatorPolicies::POLICY_ADMIN) | ||||
->attachAlmanacProperties(array()) | ->attachAlmanacProperties(array()) | ||||
->setIsLocked(0); | ->setIsLocked(0); | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | if ($this->hasAlmanacProperty($key)) { | ||||
return $default; | return $default; | ||||
} | } | ||||
} | } | ||||
public function getAlmanacPropertyFieldSpecifications() { | public function getAlmanacPropertyFieldSpecifications() { | ||||
return array(); | return array(); | ||||
} | } | ||||
public function newAlmanacPropertyEditEngine() { | |||||
return new AlmanacDevicePropertyEditEngine(); | |||||
} | |||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
Show All 25 Lines | if ($capability === PhabricatorPolicyCapability::CAN_EDIT) { | ||||
'be edited.'); | 'be edited.'); | ||||
} | } | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
/* -( PhabricatorCustomFieldInterface )------------------------------------ */ | |||||
public function getCustomFieldSpecificationForRole($role) { | |||||
return array(); | |||||
} | |||||
public function getCustomFieldBaseClass() { | |||||
return 'AlmanacCustomField'; | |||||
} | |||||
public function getCustomFields() { | |||||
return $this->assertAttached($this->customFields); | |||||
} | |||||
public function attachCustomFields(PhabricatorCustomFieldAttachment $fields) { | |||||
$this->customFields = $fields; | |||||
return $this; | |||||
} | |||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
return new AlmanacDeviceEditor(); | return new AlmanacDeviceEditor(); | ||||
} | } | ||||
public function getApplicationTransactionObject() { | public function getApplicationTransactionObject() { | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |