Differential D20039 Diff 47880 src/applications/auth/editor/PhabricatorAuthFactorProviderEditEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/editor/PhabricatorAuthFactorProviderEditEngine.php
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | final class PhabricatorAuthFactorProviderEditEngine | ||||
| } | } | ||||
| protected function getCreateNewObjectPolicy() { | protected function getCreateNewObjectPolicy() { | ||||
| return $this->getApplication()->getPolicy( | return $this->getApplication()->getPolicy( | ||||
| AuthManageProvidersCapability::CAPABILITY); | AuthManageProvidersCapability::CAPABILITY); | ||||
| } | } | ||||
| protected function buildCustomEditFields($object) { | protected function buildCustomEditFields($object) { | ||||
| $factor_name = $object->getFactor()->getFactorName(); | $factor = $object->getFactor(); | ||||
| $factor_name = $factor->getFactorName(); | |||||
| $status_map = PhabricatorAuthFactorProviderStatus::getMap(); | $status_map = PhabricatorAuthFactorProviderStatus::getMap(); | ||||
| return array( | $fields = array( | ||||
| id(new PhabricatorStaticEditField()) | id(new PhabricatorStaticEditField()) | ||||
| ->setKey('displayType') | ->setKey('displayType') | ||||
| ->setLabel(pht('Factor Type')) | ->setLabel(pht('Factor Type')) | ||||
| ->setDescription(pht('Type of the MFA provider.')) | ->setDescription(pht('Type of the MFA provider.')) | ||||
| ->setValue($factor_name), | ->setValue($factor_name), | ||||
| id(new PhabricatorTextEditField()) | id(new PhabricatorTextEditField()) | ||||
| ->setKey('name') | ->setKey('name') | ||||
| ->setTransactionType( | ->setTransactionType( | ||||
| PhabricatorAuthFactorProviderNameTransaction::TRANSACTIONTYPE) | PhabricatorAuthFactorProviderNameTransaction::TRANSACTIONTYPE) | ||||
| ->setLabel(pht('Name')) | ->setLabel(pht('Name')) | ||||
| ->setDescription(pht('Display name for the MFA provider.')) | ->setDescription(pht('Display name for the MFA provider.')) | ||||
| ->setValue($object->getName()) | ->setValue($object->getName()) | ||||
| ->setPlaceholder($factor_name), | ->setPlaceholder($factor_name), | ||||
| id(new PhabricatorSelectEditField()) | id(new PhabricatorSelectEditField()) | ||||
| ->setKey('status') | ->setKey('status') | ||||
| ->setTransactionType( | ->setTransactionType( | ||||
| PhabricatorAuthFactorProviderStatusTransaction::TRANSACTIONTYPE) | PhabricatorAuthFactorProviderStatusTransaction::TRANSACTIONTYPE) | ||||
| ->setLabel(pht('Status')) | ->setLabel(pht('Status')) | ||||
| ->setDescription(pht('Status of the MFA provider.')) | ->setDescription(pht('Status of the MFA provider.')) | ||||
| ->setValue($object->getStatus()) | ->setValue($object->getStatus()) | ||||
| ->setOptions($status_map), | ->setOptions($status_map), | ||||
| ); | ); | ||||
| $factor_fields = $factor->newEditEngineFields($this, $object); | |||||
| foreach ($factor_fields as $field) { | |||||
| $fields[] = $field; | |||||
| } | |||||
| return $fields; | |||||
| } | } | ||||
| } | } | ||||