Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93596039
AlmanacManagementUntrustKeyWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 30, 01:01
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Dec 2, 01:01 (2 d)
Engine
blob
Format
Raw Data
Handle
22670226
Attached To
rPH Phabricator
AlmanacManagementUntrustKeyWorkflow.php
View Options
<?php
final
class
AlmanacManagementUntrustKeyWorkflow
extends
AlmanacManagementWorkflow
{
public
function
didConstruct
()
{
$this
->
setName
(
'untrust-key'
)
->
setSynopsis
(
pht
(
'Revoke trust of a public key.'
))
->
setArguments
(
array
(
array
(
'name'
=>
'id'
,
'param'
=>
'id'
,
'help'
=>
pht
(
'ID of the key to revoke trust for.'
),
),
));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$console
=
PhutilConsole
::
getConsole
();
$id
=
$args
->
getArg
(
'id'
);
if
(!
$id
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Specify a public key to revoke trust for with --id.'
));
}
$key
=
id
(
new
PhabricatorAuthSSHKeyQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withIDs
(
array
(
$id
))
->
executeOne
();
if
(!
$key
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'No public key exists with ID "%s".'
,
$id
));
}
if
(!
$key
->
getIsTrusted
())
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Public key with ID %s is not trusted.'
,
$id
));
}
$key
->
setIsTrusted
(
0
);
$key
->
save
();
$console
->
writeOut
(
"**<bg:green> %s </bg>** %s
\n
"
,
pht
(
'TRUST REVOKED'
),
pht
(
'Trust has been revoked for public key %s.'
,
$id
));
}
}
Event Timeline
Log In to Comment