From: Tim Otten Date: Mon, 2 Nov 2020 06:17:06 +0000 (-0800) Subject: dev/core#2141 - Basic UI for CRUD'ing clients X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=128850fdeeefc12ed8eea7a610a43dccb27c0808;p=civicrm-core.git dev/core#2141 - Basic UI for CRUD'ing clients --- diff --git a/ext/oauth-client/CRM/OAuth/Angular.php b/ext/oauth-client/CRM/OAuth/Angular.php new file mode 100644 index 0000000000..4f0bc3337f --- /dev/null +++ b/ext/oauth-client/CRM/OAuth/Angular.php @@ -0,0 +1,14 @@ +indexBy('name'); + + return $s; + } + +} diff --git a/ext/oauth-client/ang/oauthClientAdmin.aff.html b/ext/oauth-client/ang/oauthClientAdmin.aff.html new file mode 100644 index 0000000000..234fa9bd9b --- /dev/null +++ b/ext/oauth-client/ang/oauthClientAdmin.aff.html @@ -0,0 +1,11 @@ +
+ +
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/ext/oauth-client/ang/oauthClientAdmin.aff.json b/ext/oauth-client/ang/oauthClientAdmin.aff.json new file mode 100644 index 0000000000..dbc4750189 --- /dev/null +++ b/ext/oauth-client/ang/oauthClientAdmin.aff.json @@ -0,0 +1,5 @@ +{ + "title": "OAuth2 Client Administration", + "server_route": "civicrm/admin/oauth", + "permission": "manage OAuth client" +} diff --git a/ext/oauth-client/ang/oauthClientCreateHelp.aff.html b/ext/oauth-client/ang/oauthClientCreateHelp.aff.html new file mode 100644 index 0000000000..4af0fa8be0 --- /dev/null +++ b/ext/oauth-client/ang/oauthClientCreateHelp.aff.html @@ -0,0 +1,32 @@ +
+
+

{{ts('Please register with your web-service provider first. Be sure to:')}}

+ +

{{ts('Finally, copy the client credentials below:')}}

+
\ No newline at end of file diff --git a/ext/oauth-client/ang/oauthClientCreator.aff.html b/ext/oauth-client/ang/oauthClientCreator.aff.html new file mode 100644 index 0000000000..15e7443575 --- /dev/null +++ b/ext/oauth-client/ang/oauthClientCreator.aff.html @@ -0,0 +1,14 @@ +
+ +
+
+
+ + +
+
+ + +
+
+
diff --git a/ext/oauth-client/ang/oauthClientEditor.aff.html b/ext/oauth-client/ang/oauthClientEditor.aff.html new file mode 100644 index 0000000000..7588460ebc --- /dev/null +++ b/ext/oauth-client/ang/oauthClientEditor.aff.html @@ -0,0 +1,32 @@ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
diff --git a/ext/oauth-client/ang/oauthClientList.aff.html b/ext/oauth-client/ang/oauthClientList.aff.html new file mode 100644 index 0000000000..923a439a14 --- /dev/null +++ b/ext/oauth-client/ang/oauthClientList.aff.html @@ -0,0 +1,46 @@ +
+ +
+ {{ts('There are no clients!')}} +
+ + + + + + + + + + + + + + + + + + +
{{ts('ID')}}{{ts('Provider')}}{{ts('GUID')}}
+ {{availClient.id}} + {{availClient.provider}}{{availClient.guid}} + + {{ts('Delete')}} +
+ +
diff --git a/ext/oauth-client/ang/oauthClientTokens.aff.html b/ext/oauth-client/ang/oauthClientTokens.aff.html new file mode 100644 index 0000000000..5d463e4ce0 --- /dev/null +++ b/ext/oauth-client/ang/oauthClientTokens.aff.html @@ -0,0 +1,33 @@ +
+
+
+ {{ts('No tokens found')}} +
+ + + + + + + + + + + + + + + + + + +
{{ts('ID')}}{{ts('Tag')}}{{ts('On Behalf Of')}}{{ts('Scopes')}}{{ts('Created Date')}}{{ts('Actions')}}
{{token.id}}{{token.tag}}{{token.resource_owner_name}}{{token.scopes.join(" ")}}{{token.created_date}} + +
diff --git a/ext/oauth-client/ang/oauthProviderDetail.aff.html b/ext/oauth-client/ang/oauthProviderDetail.aff.html new file mode 100644 index 0000000000..1b19df6565 --- /dev/null +++ b/ext/oauth-client/ang/oauthProviderDetail.aff.html @@ -0,0 +1,55 @@ +

{{options.provider.title}}

+ +
+ +
+
+ + +
+
{{options.provider|json}}
+
+ +
+
+

{{ts('Tokens')}}

+ +
+ + + +

{{ts('Properties')}}

+ +
+ + +
+
+ +
+
+
+
+ +
+
+ +
diff --git a/ext/oauth-client/ang/oauthProviderList.aff.html b/ext/oauth-client/ang/oauthProviderList.aff.html new file mode 100644 index 0000000000..3b797a6787 --- /dev/null +++ b/ext/oauth-client/ang/oauthProviderList.aff.html @@ -0,0 +1,30 @@ +
+ +
+

+ {{ts('CiviCRM may be configured as a client that interacts with remote web-services, such as Google Mail or Microsoft Exchange. Please choose the type of web-service you wish to connect to:')}} +

+ + +
+ + + + + + + + + + + + + + +
{{ts('Name')}}{{ts('Title')}}
+ {{provider.name}} + + {{provider.title}} +
diff --git a/ext/oauth-client/ang/oauthUtil.ang.php b/ext/oauth-client/ang/oauthUtil.ang.php new file mode 100644 index 0000000000..759f5856a2 --- /dev/null +++ b/ext/oauth-client/ang/oauthUtil.ang.php @@ -0,0 +1,20 @@ + [ + 'ang/oauthUtil.js', + // 'ang/oauthUtil/*.js', + // 'ang/oauthUtil/*/*.js', + ], + // 'css' => ['ang/oauthUtil.css'], + // 'partials' => ['ang/oauthUtil'], + // 'requires' => ['crmUi', 'crmUtil'], + 'settings' => [], + 'settingsFactory' => ['CRM_OAuth_Angular', 'getSettings'], + 'exports' => [ + 'oauth-util-import' => 'A', + 'oauth-util-grant-ctrl' => 'A', + ], +]; diff --git a/ext/oauth-client/ang/oauthUtil.js b/ext/oauth-client/ang/oauthUtil.js new file mode 100644 index 0000000000..f436510b02 --- /dev/null +++ b/ext/oauth-client/ang/oauthUtil.js @@ -0,0 +1,48 @@ +(function(angular, $, _) { + angular.module('oauthUtil', CRM.angRequires('oauthUtil')); + // Import data from the 'CRM.foo' settings. + // Ex:
+ angular.module('oauthUtil').directive('oauthUtilImport', function() { + return { + restrict: 'EA', + scope: { + to: '=', + oauthUtilImport: '@' + }, + controller: function($scope, $parse) { + $scope.to = $parse($scope.oauthUtilImport)({CRM: CRM}); + } + }; + }); + angular.module('oauthUtil').directive('oauthUtilGrantCtrl', function() { + return { + restrict: 'EA', + scope: { + oauthUtilGrantCtrl: '=' + }, + controllerAs: 'oauthUtilGrantCtrl', + controller: function($scope, $parse, crmBlocker, crmApi4, crmStatus) { + var block = crmBlocker(); + var ctrl = this; + ctrl.authCode = function(clientId) { + var confirmOpt = { + message: ts('You are about to be redirected to an external site.'), + options: {no: ts('Cancel'), yes: ts('Continue')} + }; + CRM.confirm(confirmOpt) + .on('crmConfirm:yes', function(){ + var going = crmApi4('OAuthClient', 'authorizationCode', { + 'landingUrl': window.location.href, + 'where': [['id', '=', clientId]] + }).then(function(r){ + window.location = r[0].url; + }); + return block(crmStatus({start: ts('Redirecting...'), success: ts('Redirecting...')}, going)); + }); + }; + + $scope.oauthUtilGrantCtrl = this; + } + }; + }); +})(angular, CRM.$, CRM._); diff --git a/ext/oauth-client/info.xml b/ext/oauth-client/info.xml index cca744c2c4..f0b5fa530f 100644 --- a/ext/oauth-client/info.xml +++ b/ext/oauth-client/info.xml @@ -23,6 +23,9 @@ 5.0 + + org.civicrm.afform + This is a new, undeveloped module