phorge/src/applications/people/management/PhabricatorPeopleManagementEmpowerWorkflow.php
epriestley fc34554892 Replace "bin/people profileimage" with "bin/user enable|empower"
Summary:
Ref T13382.

  - Remove "bin/people profileimage" which previously generated profile image caches but now feels obsolete.
  - Replace it with "bin/user", with "enable" and "empower" flows. This command is now focused on regaining access to an install after you lock your keys inside.
  - Document the various ways to unlock objects and accounts from the CLI.

Test Plan:
  - Ran `bin/user enable` and `bin/user empower` with various flags.
  - Grepped for `people profileimage` and found no references.
  - Grepped for `bin/people` and found no references.
  - Read documentation.

Maniphest Tasks: T13382

Differential Revision: https://secure.phabricator.com/D20724
2019-08-20 17:51:14 -07:00

45 lines
1.2 KiB
PHP

<?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;
}
}