Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14045273
D19577.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D19577.diff
View Options
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 @@
+<?php
+
+final class UserEditConduitAPIMethod
+ extends PhabricatorEditEngineAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'user.edit';
+ }
+
+ public function newEditEngine() {
+ return new PhabricatorUserEditEngine();
+ }
+
+ public function getMethodSummary() {
+ return pht(
+ 'Apply transactions to edit a user. (Users can not be created via '.
+ 'the API.)');
+ }
+
+}
diff --git a/src/applications/people/customfield/PhabricatorUserBlurbField.php b/src/applications/people/customfield/PhabricatorUserBlurbField.php
--- a/src/applications/people/customfield/PhabricatorUserBlurbField.php
+++ b/src/applications/people/customfield/PhabricatorUserBlurbField.php
@@ -9,6 +9,14 @@
return 'user:blurb';
}
+ public function getModernFieldKey() {
+ return 'blurb';
+ }
+
+ public function getFieldKeyForConduit() {
+ return $this->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 @@
+<?php
+
+final class PhabricatorUserEditEngine
+ extends PhabricatorEditEngine {
+
+ const ENGINECONST = 'people.user';
+
+ public function isEngineConfigurable() {
+ return false;
+ }
+
+ public function getEngineName() {
+ return pht('Users');
+ }
+
+ public function getSummaryHeader() {
+ return pht('Configure User Forms');
+ }
+
+ public function getSummaryText() {
+ return pht('Configure creation and editing forms for users.');
+ }
+
+ public function getEngineApplicationClass() {
+ return 'PhabricatorPeopleApplication';
+ }
+
+ protected function newEditableObject() {
+ return new PhabricatorUser();
+ }
+
+ protected function newObjectQuery() {
+ return id(new PhabricatorPeopleQuery());
+ }
+
+ protected function getObjectCreateTitleText($object) {
+ return pht('Create New User');
+ }
+
+ protected function getObjectEditTitleText($object) {
+ return pht('Edit User: %s', $object->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();
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 14, 2:32 AM (3 d, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6726251
Default Alt Text
D19577.diff (9 KB)
Attached To
Mode
D19577: Add a modern "user.edit" API method for users
Attached
Detach File
Event Timeline
Log In to Comment