Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F107455849
PhabricatorAuthSSHKeyDeactivateController.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
Tue, Apr 8, 10:32
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Apr 10, 10:32 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25414625
Attached To
rPH Phabricator
PhabricatorAuthSSHKeyDeactivateController.php
View Options
<?php
final
class
PhabricatorAuthSSHKeyDeactivateController
extends
PhabricatorAuthSSHKeyController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$key
=
id
(
new
PhabricatorAuthSSHKeyQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$request
->
getURIData
(
'id'
)))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$key
)
{
return
new
Aphront404Response
();
}
$cancel_uri
=
$key
->
getURI
();
$token
=
id
(
new
PhabricatorAuthSessionEngine
())->
requireHighSecuritySession
(
$viewer
,
$request
,
$cancel_uri
);
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorAuthSSHKeyTransaction
())
->
setTransactionType
(
PhabricatorAuthSSHKeyTransaction
::
TYPE_DEACTIVATE
)
->
setNewValue
(
true
);
id
(
new
PhabricatorAuthSSHKeyEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$key
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$cancel_uri
);
}
$name
=
phutil_tag
(
'strong'
,
array
(),
$key
->
getName
());
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Deactivate SSH Public Key'
))
->
appendParagraph
(
pht
(
'The key "%s" will be permanently deactivated, and you will no '
.
'longer be able to use the corresponding private key to '
.
'authenticate.'
,
$name
))
->
addSubmitButton
(
pht
(
'Deactivate Public Key'
))
->
addCancelButton
(
$cancel_uri
);
}
}
Event Timeline
Log In to Comment