Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4852575
UserEnableConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
UserEnableConduitAPIMethod.php
View Options
<?php
final
class
UserEnableConduitAPIMethod
extends
UserConduitAPIMethod
{
public
function
getAPIMethodName
(
)
{
return
'user.enable'
;
}
public
function
getMethodDescription
(
)
{
return
'Re-enable specified users (admin only).'
;
}
public
function
defineParamTypes
(
)
{
return
array
(
'phids'
=>
'required list<phid>'
,
)
;
}
public
function
defineReturnType
(
)
{
return
'void'
;
}
public
function
defineErrorTypes
(
)
{
return
array
(
'ERR-PERMISSIONS'
=>
'Only admins can call this method.'
,
'ERR-BAD-PHID'
=>
'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
,
false
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Jun 9, 06:41 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1768478
Default Alt Text
UserEnableConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment