Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F105853047
PhabricatorAuthSSHKeyDeleteController.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
Thu, Mar 20, 06:52
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Mar 22, 06:52 (2 d)
Engine
blob
Format
Raw Data
Handle
25021623
Attached To
rPH Phabricator
PhabricatorAuthSSHKeyDeleteController.php
View Options
<?php
final
class
PhabricatorAuthSSHKeyDeleteController
extends
PhabricatorAuthSSHKeyController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$key
=
id
(
new
PhabricatorAuthSSHKeyQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$request
->
getURIData
(
'id'
)))
->
withIsActive
(
true
)
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$key
)
{
return
new
Aphront404Response
();
}
$cancel_uri
=
$key
->
getObject
()->
getSSHPublicKeyManagementURI
(
$viewer
);
$token
=
id
(
new
PhabricatorAuthSessionEngine
())->
requireHighSecuritySession
(
$viewer
,
$request
,
$cancel_uri
);
if
(
$request
->
isFormPost
())
{
// TODO: Convert to transactions.
$key
->
setIsActive
(
null
);
$key
->
save
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$cancel_uri
);
}
$name
=
phutil_tag
(
'strong'
,
array
(),
$key
->
getName
());
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Really delete SSH Public Key?'
))
->
appendParagraph
(
pht
(
'The key "%s" will be permanently deleted, and you will not longer '
.
'be able to use the corresponding private key to authenticate.'
,
$name
))
->
addSubmitButton
(
pht
(
'Delete Public Key'
))
->
addCancelButton
(
$cancel_uri
);
}
}
Event Timeline
Log In to Comment