4 final class PhabricatorPeopleManagementApproveWorkflow
5 extends PhabricatorPeopleManagementWorkflow
{
7 protected function didConstruct() {
8 $arguments = array_merge(
9 $this->getUserSelectionArguments(),
14 ->setExamples('**approve** --user __username__')
15 ->setSynopsis(pht('Approves a user.'))
16 ->setArguments($arguments);
19 public function execute(PhutilArgumentParser
$args) {
20 $user = $this->selectUser($args);
21 $display_name = $user->getUsername();
23 if ($user->getIsApproved()) {
24 throw new PhutilArgumentUsageException(
26 'User account "%s" is already approved. You can only '.
27 'approve accounts that are not yet approved.',
32 $xactions[] = $user->getApplicationTransactionTemplate()
33 ->setTransactionType(PhabricatorUserApproveTransaction
::TRANSACTIONTYPE
)
36 $this->applyTransactions($user, $xactions);
40 pht('Approved user account "%s".', $display_name));