Differential D21757 Diff 51866 src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | public function execute(PhutilArgumentParser $args) { | ||||
// The "--list" flag is compatible with revoker selection flags like | // The "--list" flag is compatible with revoker selection flags like | ||||
// "--type" to filter the list, but not compatible with target selection | // "--type" to filter the list, but not compatible with target selection | ||||
// flags like "--from". | // flags like "--from". | ||||
$is_list = $args->getArg('list'); | $is_list = $args->getArg('list'); | ||||
$type = $args->getArg('type'); | $type = $args->getArg('type'); | ||||
$is_everything = $args->getArg('everything'); | $is_everything = $args->getArg('everything'); | ||||
if (!strlen($type) && !$is_everything) { | if ($type === null && !$is_everything) { | ||||
if ($is_list) { | if ($is_list) { | ||||
// By default, "bin/revoke --list" implies "--everything". | // By default, "bin/revoke --list" implies "--everything". | ||||
$types = $all_types; | $types = $all_types; | ||||
} else { | } else { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht( | pht( | ||||
'Specify the credential type to revoke with "--type" or specify '. | 'Specify the credential type to revoke with "--type" or specify '. | ||||
'"--everything". Use "--list" to list available credential '. | '"--everything". Use "--list" to list available credential '. | ||||
Show All 17 Lines | if ($type === null && !$is_everything) { | ||||
} | } | ||||
$types = array($all_types[$type]); | $types = array($all_types[$type]); | ||||
} | } | ||||
$is_everywhere = $args->getArg('everywhere'); | $is_everywhere = $args->getArg('everywhere'); | ||||
$from = $args->getArg('from'); | $from = $args->getArg('from'); | ||||
if ($is_list) { | if ($is_list) { | ||||
if (strlen($from) || $is_everywhere) { | if ($from !== null || $is_everywhere) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht( | pht( | ||||
'You can not "--list" and revoke credentials (with "--from" or '. | 'You can not "--list" and revoke credentials (with "--from" or '. | ||||
'"--everywhere") in the same operation.')); | '"--everywhere") in the same operation.')); | ||||
} | } | ||||
} | } | ||||
if ($is_list) { | if ($is_list) { | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |