3 final class PhabricatorOAuthServerEditEngine
4 extends PhabricatorEditEngine
{
6 const ENGINECONST
= 'oauthserver.application';
8 public function isEngineConfigurable() {
12 public function getEngineName() {
13 return pht('OAuth Applications');
16 public function getSummaryHeader() {
17 return pht('Edit OAuth Applications');
20 public function getSummaryText() {
21 return pht('This engine manages OAuth client applications.');
24 public function getEngineApplicationClass() {
25 return 'PhabricatorOAuthServerApplication';
28 protected function newEditableObject() {
29 return PhabricatorOAuthServerClient
::initializeNewClient(
33 protected function newObjectQuery() {
34 return id(new PhabricatorOAuthServerClientQuery());
37 protected function getObjectCreateTitleText($object) {
38 return pht('Create OAuth Server');
41 protected function getObjectCreateButtonText($object) {
42 return pht('Create OAuth Server');
45 protected function getObjectEditTitleText($object) {
46 return pht('Edit OAuth Server: %s', $object->getName());
49 protected function getObjectEditShortText($object) {
50 return pht('Edit OAuth Server');
53 protected function getObjectCreateShortText() {
54 return pht('Create OAuth Server');
57 protected function getObjectName() {
58 return pht('OAuth Server');
61 protected function getObjectViewURI($object) {
62 return $object->getViewURI();
65 protected function getCreateNewObjectPolicy() {
66 return $this->getApplication()->getPolicy(
67 PhabricatorOAuthServerCreateClientsCapability
::CAPABILITY
);
70 protected function buildCustomEditFields($object) {
72 id(new PhabricatorTextEditField())
74 ->setLabel(pht('Name'))
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'))
86 PhabricatorOAuthServerTransaction
::TYPE_REDIRECT_URI
)
88 pht('The redirect URI for OAuth handshakes.'))
89 ->setConduitDescription(
91 'Change where this application redirects users to during OAuth '.
93 ->setConduitTypeDescription(
95 'New OAuth application redirect URI.'))
96 ->setValue($object->getRedirectURI()),