Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/storage/PhabricatorAuthContactNumber.php
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | public function newUniqueKey() { | ||||
| ); | ); | ||||
| $parts = implode("\0", $parts); | $parts = implode("\0", $parts); | ||||
| return PhabricatorHash::digestForIndex($parts); | return PhabricatorHash::digestForIndex($parts); | ||||
| } | } | ||||
| public function save() { | public function save() { | ||||
| // We require that active contact numbers be unique, but it's okay to | |||||
| // disable a number and then reuse it somewhere else. | |||||
| if ($this->isDisabled()) { | |||||
| $this->uniqueKey = null; | |||||
| } else { | |||||
| $this->uniqueKey = $this->newUniqueKey(); | $this->uniqueKey = $this->newUniqueKey(); | ||||
| } | |||||
| return parent::save(); | return parent::save(); | ||||
| } | } | ||||
| public static function getStatusNameMap() { | |||||
| return ipull(self::getStatusPropertyMap(), 'name'); | |||||
| } | |||||
| private static function getStatusPropertyMap() { | |||||
| return array( | |||||
| self::STATUS_ACTIVE => array( | |||||
| 'name' => pht('Active'), | |||||
| ), | |||||
| self::STATUS_DISABLED => array( | |||||
| 'name' => pht('Disabled'), | |||||
| ), | |||||
| ); | |||||
| } | |||||
| /* -( 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 34 Lines | |||||