@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add Conduit method to disable user

Summary: There's no method for enabling users somewhat intentionally.

Test Plan: Disable myself (oops, this is probably my last diff ever).

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D2497

vrana 8dca5cdb db1f94b0

+85
+2
src/__phutil_library_map__.php
··· 184 184 'ConduitAPI_slowvote_info_Method' => 'applications/conduit/method/slowvote/info', 185 185 'ConduitAPI_user_Method' => 'applications/conduit/method/user/base', 186 186 'ConduitAPI_user_addstatus_Method' => 'applications/conduit/method/user/addstatus', 187 + 'ConduitAPI_user_disable_Method' => 'applications/conduit/method/user/disable', 187 188 'ConduitAPI_user_find_Method' => 'applications/conduit/method/user/find', 188 189 'ConduitAPI_user_getcurrentstatus_Method' => 'applications/conduit/method/user/getcurrentstatus', 189 190 'ConduitAPI_user_info_Method' => 'applications/conduit/method/user/info', ··· 1217 1218 'ConduitAPI_slowvote_info_Method' => 'ConduitAPIMethod', 1218 1219 'ConduitAPI_user_Method' => 'ConduitAPIMethod', 1219 1220 'ConduitAPI_user_addstatus_Method' => 'ConduitAPI_user_Method', 1221 + 'ConduitAPI_user_disable_Method' => 'ConduitAPI_user_Method', 1220 1222 'ConduitAPI_user_find_Method' => 'ConduitAPI_user_Method', 1221 1223 'ConduitAPI_user_getcurrentstatus_Method' => 'ConduitAPI_user_Method', 1222 1224 'ConduitAPI_user_info_Method' => 'ConduitAPI_user_Method',
+67
src/applications/conduit/method/user/disable/ConduitAPI_user_disable_Method.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group conduit 21 + */ 22 + final class ConduitAPI_user_disable_Method 23 + extends ConduitAPI_user_Method { 24 + 25 + public function getMethodDescription() { 26 + return "Permanently disable specified users (admin only)."; 27 + } 28 + 29 + public function defineParamTypes() { 30 + return array( 31 + 'phids' => 'required list<phid>', 32 + ); 33 + } 34 + 35 + public function defineReturnType() { 36 + return 'void'; 37 + } 38 + 39 + public function defineErrorTypes() { 40 + return array( 41 + 'ERR-PERMISSIONS' => 'Only admins can call this method.', 42 + 'ERR-BAD-PHID' => 'Non existent user PHID.', 43 + ); 44 + } 45 + 46 + protected function execute(ConduitAPIRequest $request) { 47 + if (!$request->getUser()->getIsAdmin()) { 48 + throw new ConduitException('ERR-PERMISSIONS'); 49 + } 50 + 51 + $phids = $request->getValue('phids'); 52 + 53 + $users = id(new PhabricatorUser())->loadAllWhere( 54 + 'phid IN (%Ls)', 55 + $phids); 56 + 57 + if (count($phids) != count($users)) { 58 + throw new ConduitException('ERR-BAD-PHID'); 59 + } 60 + 61 + foreach ($users as $user) { 62 + $user->setIsDisabled(true); 63 + $user->save(); 64 + } 65 + } 66 + 67 + }
+16
src/applications/conduit/method/user/disable/__init__.php
··· 1 + <?php 2 + /** 3 + * This file is automatically generated. Lint this module to rebuild it. 4 + * @generated 5 + */ 6 + 7 + 8 + 9 + phutil_require_module('phabricator', 'applications/conduit/method/user/base'); 10 + phutil_require_module('phabricator', 'applications/conduit/protocol/exception'); 11 + phutil_require_module('phabricator', 'applications/people/storage/user'); 12 + 13 + phutil_require_module('phutil', 'utils'); 14 + 15 + 16 + phutil_require_source('ConduitAPI_user_disable_Method.php');