Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/oauthserver/editor/PhabricatorOAuthServerEditEngine.php
12241 views
1
<?php
2
3
final class PhabricatorOAuthServerEditEngine
4
extends PhabricatorEditEngine {
5
6
const ENGINECONST = 'oauthserver.application';
7
8
public function isEngineConfigurable() {
9
return false;
10
}
11
12
public function getEngineName() {
13
return pht('OAuth Applications');
14
}
15
16
public function getSummaryHeader() {
17
return pht('Edit OAuth Applications');
18
}
19
20
public function getSummaryText() {
21
return pht('This engine manages OAuth client applications.');
22
}
23
24
public function getEngineApplicationClass() {
25
return 'PhabricatorOAuthServerApplication';
26
}
27
28
protected function newEditableObject() {
29
return PhabricatorOAuthServerClient::initializeNewClient(
30
$this->getViewer());
31
}
32
33
protected function newObjectQuery() {
34
return id(new PhabricatorOAuthServerClientQuery());
35
}
36
37
protected function getObjectCreateTitleText($object) {
38
return pht('Create OAuth Server');
39
}
40
41
protected function getObjectCreateButtonText($object) {
42
return pht('Create OAuth Server');
43
}
44
45
protected function getObjectEditTitleText($object) {
46
return pht('Edit OAuth Server: %s', $object->getName());
47
}
48
49
protected function getObjectEditShortText($object) {
50
return pht('Edit OAuth Server');
51
}
52
53
protected function getObjectCreateShortText() {
54
return pht('Create OAuth Server');
55
}
56
57
protected function getObjectName() {
58
return pht('OAuth Server');
59
}
60
61
protected function getObjectViewURI($object) {
62
return $object->getViewURI();
63
}
64
65
protected function getCreateNewObjectPolicy() {
66
return $this->getApplication()->getPolicy(
67
PhabricatorOAuthServerCreateClientsCapability::CAPABILITY);
68
}
69
70
protected function buildCustomEditFields($object) {
71
return array(
72
id(new PhabricatorTextEditField())
73
->setKey('name')
74
->setLabel(pht('Name'))
75
->setIsRequired(true)
76
->setTransactionType(PhabricatorOAuthServerTransaction::TYPE_NAME)
77
->setDescription(pht('The name of the OAuth application.'))
78
->setConduitDescription(pht('Rename the application.'))
79
->setConduitTypeDescription(pht('New application name.'))
80
->setValue($object->getName()),
81
id(new PhabricatorTextEditField())
82
->setKey('redirectURI')
83
->setLabel(pht('Redirect URI'))
84
->setIsRequired(true)
85
->setTransactionType(
86
PhabricatorOAuthServerTransaction::TYPE_REDIRECT_URI)
87
->setDescription(
88
pht('The redirect URI for OAuth handshakes.'))
89
->setConduitDescription(
90
pht(
91
'Change where this application redirects users to during OAuth '.
92
'handshakes.'))
93
->setConduitTypeDescription(
94
pht(
95
'New OAuth application redirect URI.'))
96
->setValue($object->getRedirectURI()),
97
);
98
}
99
100
}
101
102