Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97397508
PassphraseCredentialPublicController.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, Jan 4, 08:42
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 6, 08:42 (2 d)
Engine
blob
Format
Raw Data
Handle
23398561
Attached To
rPH Phabricator
PassphraseCredentialPublicController.php
View Options
<?php
final
class
PassphraseCredentialPublicController
extends
PassphraseController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$credential
=
id
(
new
PassphraseCredentialQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
))
->
executeOne
();
if
(!
$credential
)
{
return
new
Aphront404Response
();
}
$type
=
PassphraseCredentialType
::
getTypeByConstant
(
$credential
->
getCredentialType
());
if
(!
$type
)
{
throw
new
Exception
(
pht
(
'Credential has invalid type "%s"!'
,
$type
));
}
if
(!
$type
->
hasPublicKey
())
{
throw
new
Exception
(
pht
(
'Credential has no public key!'
));
}
$view_uri
=
'/'
.
$credential
->
getMonogram
();
$public_key
=
$type
->
getPublicKey
(
$viewer
,
$credential
);
$body
=
id
(
new
PHUIFormLayoutView
())
->
appendChild
(
id
(
new
AphrontFormTextAreaControl
())
->
setLabel
(
pht
(
'Public Key'
))
->
setReadOnly
(
true
)
->
setValue
(
$public_key
));
return
$this
->
newDialog
()
->
setWidth
(
AphrontDialogView
::
WIDTH_FORM
)
->
setTitle
(
pht
(
'Public Key (%s)'
,
$credential
->
getMonogram
()))
->
appendChild
(
$body
)
->
addCancelButton
(
$view_uri
,
pht
(
'Done'
));
}
}
Event Timeline
Log In to Comment