Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15425813
D19605.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D19605.diff
View Options
diff --git a/src/applications/people/conduit/UserDisableConduitAPIMethod.php b/src/applications/people/conduit/UserDisableConduitAPIMethod.php
--- a/src/applications/people/conduit/UserDisableConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserDisableConduitAPIMethod.php
@@ -10,6 +10,14 @@
return pht('Permanently disable specified users (admin only).');
}
+ public function getMethodStatus() {
+ return self::METHOD_STATUS_DEPRECATED;
+ }
+
+ public function getMethodStatusDescription() {
+ return pht('Obsoleted by method "user.edit".');
+ }
+
protected function defineParamTypes() {
return array(
'phids' => 'required list<phid>',
@@ -43,11 +51,23 @@
throw new ConduitException('ERR-BAD-PHID');
}
- foreach ($users as $user) {
- id(new PhabricatorUserEditor())
- ->setActor($actor)
- ->disableUser($user, true);
+ foreach ($phids as $phid) {
+ $params = array(
+ 'transactions' => array(
+ array(
+ 'type' => 'disabled',
+ 'value' => true,
+ ),
+ ),
+ 'objectIdentifier' => $phid,
+ );
+
+ id(new ConduitCall('user.edit', $params))
+ ->setUser($actor)
+ ->execute();
}
+
+ return null;
}
}
diff --git a/src/applications/people/conduit/UserEnableConduitAPIMethod.php b/src/applications/people/conduit/UserEnableConduitAPIMethod.php
--- a/src/applications/people/conduit/UserEnableConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserEnableConduitAPIMethod.php
@@ -10,6 +10,14 @@
return pht('Re-enable specified users (admin only).');
}
+ public function getMethodStatus() {
+ return self::METHOD_STATUS_DEPRECATED;
+ }
+
+ public function getMethodStatusDescription() {
+ return pht('Obsoleted by method "user.edit".');
+ }
+
protected function defineParamTypes() {
return array(
'phids' => 'required list<phid>',
@@ -43,11 +51,23 @@
throw new ConduitException('ERR-BAD-PHID');
}
- foreach ($users as $user) {
- id(new PhabricatorUserEditor())
- ->setActor($actor)
- ->disableUser($user, false);
+ foreach ($phids as $phid) {
+ $params = array(
+ 'transactions' => array(
+ array(
+ 'type' => 'disabled',
+ 'value' => false,
+ ),
+ ),
+ 'objectIdentifier' => $phid,
+ );
+
+ id(new ConduitCall('user.edit', $params))
+ ->setUser($actor)
+ ->execute();
}
+
+ return null;
}
}
diff --git a/src/applications/people/editor/PhabricatorUserEditor.php b/src/applications/people/editor/PhabricatorUserEditor.php
--- a/src/applications/people/editor/PhabricatorUserEditor.php
+++ b/src/applications/people/editor/PhabricatorUserEditor.php
@@ -293,45 +293,6 @@
return $this;
}
- /**
- * @task role
- */
- public function disableUser(PhabricatorUser $user, $disable) {
- $actor = $this->requireActor();
-
- if (!$user->getID()) {
- throw new Exception(pht('User has not been created yet!'));
- }
-
- $user->openTransaction();
- $user->beginWriteLocking();
-
- $user->reload();
- if ($user->getIsDisabled() == $disable) {
- $user->endWriteLocking();
- $user->killTransaction();
- return $this;
- }
-
- $log = PhabricatorUserLog::initializeNewLog(
- $actor,
- $user->getPHID(),
- PhabricatorUserLog::ACTION_DISABLE);
- $log->setOldValue($user->getIsDisabled());
- $log->setNewValue($disable);
-
- $user->setIsDisabled((int)$disable);
- $user->save();
-
- $log->save();
-
- $user->endWriteLocking();
- $user->saveTransaction();
-
- return $this;
- }
-
-
/**
* @task role
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 24 2025, 6:16 AM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709343
Default Alt Text
D19605.diff (3 KB)
Attached To
Mode
D19605: Deprecate "user.enable" and "user.disable" API methods, redefine them in terms of "user.edit"
Attached
Detach File
Event Timeline
Log In to Comment