Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/auth/revoker/PhabricatorAuthConduitTokenRevoker.php
12256 views
1
<?php
2
3
final class PhabricatorAuthConduitTokenRevoker
4
extends PhabricatorAuthRevoker {
5
6
const REVOKERKEY = 'conduit';
7
8
public function getRevokerName() {
9
return pht('Conduit API Tokens');
10
}
11
12
public function getRevokerDescription() {
13
return pht(
14
"Revokes all Conduit API tokens used to access the API.\n\n".
15
"Users will need to use `arc install-certificate` to install new ".
16
"API tokens before `arc` commands will work. Bots and scripts which ".
17
"access the API will need to have new tokens generated and ".
18
"installed.");
19
}
20
21
public function revokeAllCredentials() {
22
$table = id(new PhabricatorConduitToken());
23
$conn = $table->establishConnection('w');
24
25
queryfx(
26
$conn,
27
'DELETE FROM %T',
28
$table->getTableName());
29
30
return $conn->getAffectedRows();
31
}
32
33
public function revokeCredentialsFrom($object) {
34
$table = id(new PhabricatorConduitToken());
35
$conn = $table->establishConnection('w');
36
37
queryfx(
38
$conn,
39
'DELETE FROM %T WHERE objectPHID = %s',
40
$table->getTableName(),
41
$object->getPHID());
42
43
return $conn->getAffectedRows();
44
}
45
46
}
47
48