Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F950695
UserDisableConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
UserDisableConduitAPIMethod.php
View Options
<?php
final
class
UserDisableConduitAPIMethod
extends
UserConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'user.disable'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Permanently disable specified users (admin only).'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'phids'
=>
'required list<phid>'
,
);
}
protected
function
defineReturnType
()
{
return
'void'
;
}
protected
function
defineErrorTypes
()
{
return
array
(
'ERR-PERMISSIONS'
=>
pht
(
'Only admins can call this method.'
),
'ERR-BAD-PHID'
=>
pht
(
'Non existent user PHID.'
),
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$actor
=
$request
->
getUser
();
if
(!
$actor
->
getIsAdmin
())
{
throw
new
ConduitException
(
'ERR-PERMISSIONS'
);
}
$phids
=
$request
->
getValue
(
'phids'
);
$users
=
id
(
new
PhabricatorUser
())->
loadAllWhere
(
'phid IN (%Ls)'
,
$phids
);
if
(
count
(
$phids
)
!=
count
(
$users
))
{
throw
new
ConduitException
(
'ERR-BAD-PHID'
);
}
foreach
(
$users
as
$user
)
{
id
(
new
PhabricatorUserEditor
())
->
setActor
(
$actor
)
->
disableUser
(
$user
,
true
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jun 17, 2:15 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
217777
Default Alt Text
UserDisableConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment