Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96191486
PassphraseCredentialListController.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
Mon, Dec 23, 14:58
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 25, 14:58 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23141207
Attached To
rPH Phabricator
PassphraseCredentialListController.php
View Options
<?php
final
class
PassphraseCredentialListController
extends
PassphraseController
implements
PhabricatorApplicationSearchResultsControllerInterface
{
private
$queryKey
;
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
willProcessRequest
(
array
$data
)
{
$this
->
queryKey
=
idx
(
$data
,
'queryKey'
);
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$controller
=
id
(
new
PhabricatorApplicationSearchController
(
$request
))
->
setQueryKey
(
$this
->
queryKey
)
->
setSearchEngine
(
new
PassphraseCredentialSearchEngine
())
->
setNavigation
(
$this
->
buildSideNavView
());
return
$this
->
delegateToController
(
$controller
);
}
public
function
renderResultsList
(
array
$credentials
,
PhabricatorSavedQuery
$query
)
{
assert_instances_of
(
$credentials
,
'PassphraseCredential'
);
$viewer
=
$this
->
getRequest
()->
getUser
();
$list
=
new
PHUIObjectItemListView
();
$list
->
setUser
(
$viewer
);
foreach
(
$credentials
as
$credential
)
{
$item
=
id
(
new
PHUIObjectItemView
())
->
setObjectName
(
'K'
.
$credential
->
getID
())
->
setHeader
(
$credential
->
getName
())
->
setHref
(
'/K'
.
$credential
->
getID
())
->
setObject
(
$credential
);
$item
->
addAttribute
(
pht
(
'Login: %s'
,
$credential
->
getUsername
()));
if
(
$credential
->
getIsDestroyed
())
{
$item
->
addIcon
(
'disable'
,
pht
(
'Destroyed'
));
$item
->
setDisabled
(
true
);
}
$type
=
PassphraseCredentialType
::
getTypeByConstant
(
$credential
->
getCredentialType
());
if
(
$type
)
{
$item
->
addIcon
(
'wrench'
,
$type
->
getCredentialTypeName
());
}
$list
->
addItem
(
$item
);
}
return
$list
;
}
}
Event Timeline
Log In to Comment