diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4562,6 +4562,7 @@ 'PhabricatorUserCustomFieldNumericIndex' => 'applications/people/storage/PhabricatorUserCustomFieldNumericIndex.php', 'PhabricatorUserCustomFieldStringIndex' => 'applications/people/storage/PhabricatorUserCustomFieldStringIndex.php', 'PhabricatorUserDAO' => 'applications/people/storage/PhabricatorUserDAO.php', + 'PhabricatorUserEditEngine' => 'applications/people/editor/PhabricatorUserEditEngine.php', 'PhabricatorUserEditor' => 'applications/people/editor/PhabricatorUserEditor.php', 'PhabricatorUserEditorTestCase' => 'applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php', 'PhabricatorUserEmail' => 'applications/people/storage/PhabricatorUserEmail.php', @@ -5233,6 +5234,7 @@ 'TransactionSearchConduitAPIMethod' => 'applications/transactions/conduit/TransactionSearchConduitAPIMethod.php', 'UserConduitAPIMethod' => 'applications/people/conduit/UserConduitAPIMethod.php', 'UserDisableConduitAPIMethod' => 'applications/people/conduit/UserDisableConduitAPIMethod.php', + 'UserEditConduitAPIMethod' => 'applications/people/conduit/UserEditConduitAPIMethod.php', 'UserEnableConduitAPIMethod' => 'applications/people/conduit/UserEnableConduitAPIMethod.php', 'UserFindConduitAPIMethod' => 'applications/people/conduit/UserFindConduitAPIMethod.php', 'UserQueryConduitAPIMethod' => 'applications/people/conduit/UserQueryConduitAPIMethod.php', @@ -10547,6 +10549,7 @@ 'PhabricatorUserCustomFieldNumericIndex' => 'PhabricatorCustomFieldNumericIndexStorage', 'PhabricatorUserCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage', 'PhabricatorUserDAO' => 'PhabricatorLiskDAO', + 'PhabricatorUserEditEngine' => 'PhabricatorEditEngine', 'PhabricatorUserEditor' => 'PhabricatorEditor', 'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase', 'PhabricatorUserEmail' => 'PhabricatorUserDAO', @@ -11388,6 +11391,7 @@ 'TransactionSearchConduitAPIMethod' => 'ConduitAPIMethod', 'UserConduitAPIMethod' => 'ConduitAPIMethod', 'UserDisableConduitAPIMethod' => 'UserConduitAPIMethod', + 'UserEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'UserEnableConduitAPIMethod' => 'UserConduitAPIMethod', 'UserFindConduitAPIMethod' => 'UserConduitAPIMethod', 'UserQueryConduitAPIMethod' => 'UserConduitAPIMethod', diff --git a/src/applications/people/conduit/UserEditConduitAPIMethod.php b/src/applications/people/conduit/UserEditConduitAPIMethod.php new file mode 100644 --- /dev/null +++ b/src/applications/people/conduit/UserEditConduitAPIMethod.php @@ -0,0 +1,20 @@ +getModernFieldKey(); + } + public function getFieldName() { return pht('Blurb'); } @@ -50,6 +58,11 @@ $this->value = $request->getStr($this->getFieldKey()); } + public function setValueFromStorage($value) { + $this->value = $value; + return $this; + } + public function renderEditControl(array $handles) { return id(new PhabricatorRemarkupControl()) ->setUser($this->getViewer()) @@ -85,4 +98,12 @@ return 'block'; } + public function shouldAppearInConduitTransactions() { + return true; + } + + protected function newConduitEditParameterType() { + return new ConduitStringParameterType(); + } + } diff --git a/src/applications/people/customfield/PhabricatorUserIconField.php b/src/applications/people/customfield/PhabricatorUserIconField.php --- a/src/applications/people/customfield/PhabricatorUserIconField.php +++ b/src/applications/people/customfield/PhabricatorUserIconField.php @@ -9,6 +9,14 @@ return 'user:icon'; } + public function getModernFieldKey() { + return 'icon'; + } + + public function getFieldKeyForConduit() { + return $this->getModernFieldKey(); + } + public function getFieldName() { return pht('Icon'); } @@ -50,6 +58,11 @@ $this->value = $request->getStr($this->getFieldKey()); } + public function setValueFromStorage($value) { + $this->value = $value; + return $this; + } + public function renderEditControl(array $handles) { return id(new PHUIFormIconSetControl()) ->setName($this->getFieldKey()) @@ -58,4 +71,12 @@ ->setIconSet(new PhabricatorPeopleIconSet()); } + public function shouldAppearInConduitTransactions() { + return true; + } + + protected function newConduitEditParameterType() { + return new ConduitStringParameterType(); + } + } diff --git a/src/applications/people/customfield/PhabricatorUserRealNameField.php b/src/applications/people/customfield/PhabricatorUserRealNameField.php --- a/src/applications/people/customfield/PhabricatorUserRealNameField.php +++ b/src/applications/people/customfield/PhabricatorUserRealNameField.php @@ -9,6 +9,14 @@ return 'user:realname'; } + public function getModernFieldKey() { + return 'realName'; + } + + public function getFieldKeyForConduit() { + return $this->getModernFieldKey(); + } + public function getFieldName() { return pht('Real Name'); } @@ -53,6 +61,11 @@ $this->value = $request->getStr($this->getFieldKey()); } + public function setValueFromStorage($value) { + $this->value = $value; + return $this; + } + public function renderEditControl(array $handles) { return id(new AphrontFormTextControl()) ->setName($this->getFieldKey()) @@ -65,4 +78,12 @@ return PhabricatorEnv::getEnvConfig('account.editable'); } + public function shouldAppearInConduitTransactions() { + return true; + } + + protected function newConduitEditParameterType() { + return new ConduitStringParameterType(); + } + } diff --git a/src/applications/people/customfield/PhabricatorUserTitleField.php b/src/applications/people/customfield/PhabricatorUserTitleField.php --- a/src/applications/people/customfield/PhabricatorUserTitleField.php +++ b/src/applications/people/customfield/PhabricatorUserTitleField.php @@ -9,6 +9,14 @@ return 'user:title'; } + public function getModernFieldKey() { + return 'title'; + } + + public function getFieldKeyForConduit() { + return $this->getModernFieldKey(); + } + public function getFieldName() { return pht('Title'); } @@ -50,6 +58,11 @@ $this->value = $request->getStr($this->getFieldKey()); } + public function setValueFromStorage($value) { + $this->value = $value; + return $this; + } + public function renderEditControl(array $handles) { return id(new AphrontFormTextControl()) ->setName($this->getFieldKey()) @@ -57,4 +70,12 @@ ->setLabel($this->getFieldName()); } + public function shouldAppearInConduitTransactions() { + return true; + } + + protected function newConduitEditParameterType() { + return new ConduitStringParameterType(); + } + } diff --git a/src/applications/people/editor/PhabricatorUserEditEngine.php b/src/applications/people/editor/PhabricatorUserEditEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/people/editor/PhabricatorUserEditEngine.php @@ -0,0 +1,70 @@ +getUsername()); + } + + protected function getObjectEditShortText($object) { + return $object->getMonogram(); + } + + protected function getObjectCreateShortText() { + return pht('Create User'); + } + + protected function getObjectName() { + return pht('User'); + } + + protected function getObjectViewURI($object) { + return $object->getURI(); + } + + protected function getCreateNewObjectPolicy() { + // At least for now, forbid creating new users via EditEngine. This is + // primarily enforcing that "user.edit" can not create users via the API. + return PhabricatorPolicies::POLICY_NOONE; + } + + protected function buildCustomEditFields($object) { + return array(); + } + +}