Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894374
PhabricatorPeopleManagementEmpowerWorkflow.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
PhabricatorPeopleManagementEmpowerWorkflow.php
View Options
<?php
final
class
PhabricatorPeopleManagementEmpowerWorkflow
extends
PhabricatorPeopleManagementWorkflow
{
protected
function
didConstruct
(
)
{
$arguments
=
array_merge
(
$this
->
getUserSelectionArguments
(
)
,
array
(
)
)
;
$this
->
setName
(
'empower'
)
->
setExamples
(
'**empower** --user __username__'
)
->
setSynopsis
(
pht
(
'Turn a user account into an administrator account.'
)
)
->
setArguments
(
$arguments
)
;
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$user
=
$this
->
selectUser
(
$args
)
;
$display_name
=
$user
->
getUsername
(
)
;
if
(
$user
->
getIsAdmin
(
)
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'User account "%s" is already an administrator. You can only '
.
'empower accounts that are not yet administrators.'
,
$display_name
)
)
;
}
$xactions
=
array
(
)
;
$xactions
[
]
=
$user
->
getApplicationTransactionTemplate
(
)
->
setTransactionType
(
PhabricatorUserEmpowerTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
true
)
;
$this
->
applyTransactions
(
$user
,
$xactions
)
;
$this
->
logOkay
(
pht
(
'DONE'
)
,
pht
(
'Empowered user account "%s".'
,
$display_name
)
)
;
return
0
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 19:48 (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1111961
Default Alt Text
PhabricatorPeopleManagementEmpowerWorkflow.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment