Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / people / editor / PhabricatorUserEditEngine.php
blob4b3a60a2fc43d3e247f290a36eb5d480ed57867b
1 <?php
3 final class PhabricatorUserEditEngine
4 extends PhabricatorEditEngine {
6 const ENGINECONST = 'people.user';
8 public function isEngineConfigurable() {
9 return false;
12 public function getEngineName() {
13 return pht('Users');
16 public function getSummaryHeader() {
17 return pht('Configure User Forms');
20 public function getSummaryText() {
21 return pht('Configure creation and editing forms for users.');
24 public function getEngineApplicationClass() {
25 return 'PhabricatorPeopleApplication';
28 protected function newEditableObject() {
29 return new PhabricatorUser();
32 protected function newObjectQuery() {
33 return id(new PhabricatorPeopleQuery());
36 protected function getObjectCreateTitleText($object) {
37 return pht('Create New User');
40 protected function getObjectEditTitleText($object) {
41 return pht('Edit User: %s', $object->getUsername());
44 protected function getObjectEditShortText($object) {
45 return $object->getMonogram();
48 protected function getObjectCreateShortText() {
49 return pht('Create User');
52 protected function getObjectName() {
53 return pht('User');
56 protected function getObjectViewURI($object) {
57 return $object->getURI();
60 protected function getCreateNewObjectPolicy() {
61 // At least for now, forbid creating new users via EditEngine. This is
62 // primarily enforcing that "user.edit" can not create users via the API.
63 return PhabricatorPolicies::POLICY_NOONE;
66 protected function buildCustomEditFields($object) {
67 return array(
68 id(new PhabricatorBoolEditField())
69 ->setKey('disabled')
70 ->setOptions(pht('Active'), pht('Disabled'))
71 ->setLabel(pht('Disabled'))
72 ->setDescription(pht('Disable the user.'))
73 ->setTransactionType(PhabricatorUserDisableTransaction::TRANSACTIONTYPE)
74 ->setIsFormField(false)
75 ->setConduitDescription(pht('Disable or enable the user.'))
76 ->setConduitTypeDescription(pht('True to disable the user.'))
77 ->setValue($object->getIsDisabled()),
78 id(new PhabricatorBoolEditField())
79 ->setKey('approved')
80 ->setOptions(pht('Approved'), pht('Unapproved'))
81 ->setLabel(pht('Approved'))
82 ->setDescription(pht('Approve the user.'))
83 ->setTransactionType(PhabricatorUserApproveTransaction::TRANSACTIONTYPE)
84 ->setIsFormField(false)
85 ->setConduitDescription(pht('Approve or reject the user.'))
86 ->setConduitTypeDescription(pht('True to approve the user.'))
87 ->setValue($object->getIsApproved()),