Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F549222
PhabricatorPeopleManagementApproveWorkflow.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
PhabricatorPeopleManagementApproveWorkflow.php
View Options
<?php
final
class
PhabricatorPeopleManagementApproveWorkflow
extends
PhabricatorPeopleManagementWorkflow
{
protected
function
didConstruct
()
{
$arguments
=
array_merge
(
$this
->
getUserSelectionArguments
(),
array
());
$this
->
setName
(
'approve'
)
->
setExamples
(
'**approve** --user __username__'
)
->
setSynopsis
(
pht
(
'Approves a user.'
))
->
setArguments
(
$arguments
);
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$user
=
$this
->
selectUser
(
$args
);
$display_name
=
$user
->
getUsername
();
if
(
$user
->
getIsApproved
())
{
throw
new
PhutilArgumentUsageException
(
pht
(
'User account "%s" is already approved. You can only '
.
'approve accounts that are not yet approved.'
,
$display_name
));
}
$xactions
=
array
();
$xactions
[]
=
$user
->
getApplicationTransactionTemplate
()
->
setTransactionType
(
PhabricatorUserApproveTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
true
);
$this
->
applyTransactions
(
$user
,
$xactions
);
$this
->
logOkay
(
pht
(
'DONE'
),
pht
(
'Approved user account "%s".'
,
$display_name
));
return
0
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 2:04 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
116243
Default Alt Text
PhabricatorPeopleManagementApproveWorkflow.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment