Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2895002
PhabricatorAuthSSHKeyViewController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
PhabricatorAuthSSHKeyViewController.php
View Options
<?php
final
class
PhabricatorAuthSSHKeyViewController
extends
PhabricatorAuthSSHKeyController
{
public
function
shouldAllowPublic
(
)
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
(
)
;
$id
=
$request
->
getURIData
(
'id'
)
;
$ssh_key
=
id
(
new
PhabricatorAuthSSHKeyQuery
(
)
)
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
)
)
->
executeOne
(
)
;
if
(
!
$ssh_key
)
{
return
new
Aphront404Response
(
)
;
}
$this
->
setSSHKeyObject
(
$ssh_key
->
getObject
(
)
)
;
$title
=
pht
(
'SSH Key %d'
,
$ssh_key
->
getID
(
)
)
;
$curtain
=
$this
->
buildCurtain
(
$ssh_key
)
;
$details
=
$this
->
buildPropertySection
(
$ssh_key
)
;
$header
=
id
(
new
PHUIHeaderView
(
)
)
->
setUser
(
$viewer
)
->
setHeader
(
$ssh_key
->
getName
(
)
)
->
setHeaderIcon
(
'fa-key'
)
;
if
(
$ssh_key
->
getIsActive
(
)
)
{
$header
->
setStatus
(
'fa-check'
,
'bluegrey'
,
pht
(
'Active'
)
)
;
}
else
{
$header
->
setStatus
(
'fa-ban'
,
'dark'
,
pht
(
'Revoked'
)
)
;
}
$header
->
addActionLink
(
id
(
new
PHUIButtonView
(
)
)
->
setTag
(
'a'
)
->
setText
(
pht
(
'View Active Keys'
)
)
->
setHref
(
$ssh_key
->
getObject
(
)
->
getSSHPublicKeyManagementURI
(
$viewer
)
)
->
setIcon
(
'fa-list-ul'
)
)
;
$crumbs
=
$this
->
buildApplicationCrumbs
(
)
;
$crumbs
->
addTextCrumb
(
$title
)
;
$crumbs
->
setBorder
(
true
)
;
$timeline
=
$this
->
buildTransactionTimeline
(
$ssh_key
,
new
PhabricatorAuthSSHKeyTransactionQuery
(
)
)
;
$timeline
->
setShouldTerminate
(
true
)
;
$view
=
id
(
new
PHUITwoColumnView
(
)
)
->
setHeader
(
$header
)
->
setCurtain
(
$curtain
)
->
setMainColumn
(
array
(
$details
,
$timeline
,
)
)
;
return
$this
->
newPage
(
)
->
setTitle
(
$title
)
->
setCrumbs
(
$crumbs
)
->
appendChild
(
$view
)
;
}
private
function
buildCurtain
(
PhabricatorAuthSSHKey
$ssh_key
)
{
$viewer
=
$this
->
getViewer
(
)
;
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$ssh_key
,
PhabricatorPolicyCapability
::
CAN_EDIT
)
;
$id
=
$ssh_key
->
getID
(
)
;
$edit_uri
=
$this
->
getApplicationURI
(
"sshkey/edit/{$id}/"
)
;
$revoke_uri
=
$this
->
getApplicationURI
(
"sshkey/revoke/{$id}/"
)
;
$curtain
=
$this
->
newCurtainView
(
$ssh_key
)
;
$curtain
->
addAction
(
id
(
new
PhabricatorActionView
(
)
)
->
setIcon
(
'fa-pencil'
)
->
setName
(
pht
(
'Edit SSH Key'
)
)
->
setHref
(
$edit_uri
)
->
setWorkflow
(
true
)
->
setDisabled
(
!
$can_edit
)
)
;
$curtain
->
addAction
(
id
(
new
PhabricatorActionView
(
)
)
->
setIcon
(
'fa-times'
)
->
setName
(
pht
(
'Revoke SSH Key'
)
)
->
setHref
(
$revoke_uri
)
->
setWorkflow
(
true
)
->
setDisabled
(
!
$can_edit
)
)
;
return
$curtain
;
}
private
function
buildPropertySection
(
PhabricatorAuthSSHKey
$ssh_key
)
{
$viewer
=
$this
->
getViewer
(
)
;
$properties
=
id
(
new
PHUIPropertyListView
(
)
)
->
setUser
(
$viewer
)
;
$properties
->
addProperty
(
pht
(
'Public Key'
)
,
$ssh_key
->
getEntireKey
(
)
)
;
$properties
->
addProperty
(
pht
(
'Created'
)
,
phabricator_datetime
(
$ssh_key
->
getDateCreated
(
)
,
$viewer
)
)
;
return
id
(
new
PHUIObjectBoxView
(
)
)
->
setHeaderText
(
pht
(
'Details'
)
)
->
setBackground
(
PHUIObjectBoxView
::
BLUE_PROPERTY
)
->
appendChild
(
$properties
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 20:48 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128598
Default Alt Text
PhabricatorAuthSSHKeyViewController.php (3 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment