Path: blob/master/src/applications/people/editor/PhabricatorUserEditEngine.php
12256 views
<?php12final class PhabricatorUserEditEngine3extends PhabricatorEditEngine {45const ENGINECONST = 'people.user';67public function isEngineConfigurable() {8return false;9}1011public function getEngineName() {12return pht('Users');13}1415public function getSummaryHeader() {16return pht('Configure User Forms');17}1819public function getSummaryText() {20return pht('Configure creation and editing forms for users.');21}2223public function getEngineApplicationClass() {24return 'PhabricatorPeopleApplication';25}2627protected function newEditableObject() {28return new PhabricatorUser();29}3031protected function newObjectQuery() {32return id(new PhabricatorPeopleQuery());33}3435protected function getObjectCreateTitleText($object) {36return pht('Create New User');37}3839protected function getObjectEditTitleText($object) {40return pht('Edit User: %s', $object->getUsername());41}4243protected function getObjectEditShortText($object) {44return $object->getMonogram();45}4647protected function getObjectCreateShortText() {48return pht('Create User');49}5051protected function getObjectName() {52return pht('User');53}5455protected function getObjectViewURI($object) {56return $object->getURI();57}5859protected function getCreateNewObjectPolicy() {60// At least for now, forbid creating new users via EditEngine. This is61// primarily enforcing that "user.edit" can not create users via the API.62return PhabricatorPolicies::POLICY_NOONE;63}6465protected function buildCustomEditFields($object) {66return array(67id(new PhabricatorBoolEditField())68->setKey('disabled')69->setOptions(pht('Active'), pht('Disabled'))70->setLabel(pht('Disabled'))71->setDescription(pht('Disable the user.'))72->setTransactionType(PhabricatorUserDisableTransaction::TRANSACTIONTYPE)73->setIsFormField(false)74->setConduitDescription(pht('Disable or enable the user.'))75->setConduitTypeDescription(pht('True to disable the user.'))76->setValue($object->getIsDisabled()),77id(new PhabricatorBoolEditField())78->setKey('approved')79->setOptions(pht('Approved'), pht('Unapproved'))80->setLabel(pht('Approved'))81->setDescription(pht('Approve the user.'))82->setTransactionType(PhabricatorUserApproveTransaction::TRANSACTIONTYPE)83->setIsFormField(false)84->setConduitDescription(pht('Approve or reject the user.'))85->setConduitTypeDescription(pht('True to approve the user.'))86->setValue($object->getIsApproved()),87);88}8990}919293