Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F462965
PhabricatorAuthSSHRevoker.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorAuthSSHRevoker.php
View Options
<?php
final
class
PhabricatorAuthSSHRevoker
extends
PhabricatorAuthRevoker
{
const
REVOKERKEY
=
'ssh'
;
public
function
revokeAllCredentials
()
{
$query
=
new
PhabricatorAuthSSHKeyQuery
();
return
$this
->
revokeWithQuery
(
$query
);
}
public
function
revokeCredentialsFrom
(
$object
)
{
$query
=
id
(
new
PhabricatorAuthSSHKeyQuery
())
->
withObjectPHIDs
(
array
(
$object
->
getPHID
()));
return
$this
->
revokeWithQuery
(
$query
);
}
private
function
revokeWithQuery
(
PhabricatorAuthSSHKeyQuery
$query
)
{
$viewer
=
$this
->
getViewer
();
// We're only going to revoke keys which have not already been revoked.
$ssh_keys
=
$query
->
setViewer
(
$viewer
)
->
withIsActive
(
true
)
->
execute
();
$content_source
=
PhabricatorContentSource
::
newForSource
(
PhabricatorDaemonContentSource
::
SOURCECONST
);
$auth_phid
=
id
(
new
PhabricatorAuthApplication
())->
getPHID
();
foreach
(
$ssh_keys
as
$ssh_key
)
{
$xactions
=
array
();
$xactions
[]
=
$ssh_key
->
getApplicationTransactionTemplate
()
->
setTransactionType
(
PhabricatorAuthSSHKeyTransaction
::
TYPE_DEACTIVATE
)
->
setNewValue
(
1
);
$editor
=
$ssh_key
->
getApplicationTransactionEditor
()
->
setActor
(
$viewer
)
->
setActingAsPHID
(
$auth_phid
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
setContentSource
(
$content_source
)
->
applyTransactions
(
$ssh_key
,
$xactions
);
}
return
count
(
$ssh_keys
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 6:41 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
72889
Default Alt Text
PhabricatorAuthSSHRevoker.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment