Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F552069
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).'
);
}
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>'
,
);
}
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
(
$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
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 4:06 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
121524
Default Alt Text
UserDisableConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment