dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38226
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19519: support grantTypes in add/edit oauth2 client UI
------------------------------------------------------------
revno: 19519
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-06-25 14:57:12 +0700
message:
support grantTypes in add/edit oauth2 client UI
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/oauth2Clients.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/oAuth2client.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2015-06-25 06:26:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2015-06-25 07:57:12 +0000
@@ -136,4 +136,5 @@
edit_oauth2_client=Edit OAuth2 Client
name=Name
client_id=Client ID
-client_secret=Client Secret
\ No newline at end of file
+client_secret=Client Secret
+grant_types=Grant Types
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/oauth2Clients.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/oauth2Clients.js 2015-06-25 06:26:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/oauth2Clients.js 2015-06-25 07:57:12 +0000
@@ -1,6 +1,6 @@
var OAuth2Service = {
save: function(o, id) {
- if( !id ) {
+ if( !!id ) {
return $.ajax({
url: '../api/oAuth2Clients/' + id,
type: 'PUT',
@@ -25,14 +25,40 @@
$('#name').val(o.name);
$('#clientId').val(o.cid);
$('#clientSecret').val(o.secret);
+
+ if( o.grantTypes.indexOf('password') != -1 ) {
+ $('#gtPassword').attr('checked', true);
+ }
+
+ if( o.grantTypes.indexOf('refresh_token') != -1 ) {
+ $('#gtRefreshToken').attr('checked', true);
+ }
+
+ if( o.grantTypes.indexOf('authorization_code') != -1 ) {
+ $('#gtAuthorizationCode').attr('checked', true);
+ }
},
toJson: function() {
var o = {};
+ o.grantTypes = [];
+ o.redirectUris = [];
o.name = $('#name').val();
o.cid = $('#clientId').val();
o.secret = $('#clientSecret').val();
+ if( $('#gtPassword').is(':checked') ) {
+ o.grantTypes.push("password");
+ }
+
+ if( $('#gtRefreshToken').is(':checked') ) {
+ o.grantTypes.push("refresh_token");
+ }
+
+ if( $('#gtAuthorizationCode').is(':checked') ) {
+ o.grantTypes.push("authorization_code");
+ }
+
return o;
},
getUuid: function() {
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/oAuth2client.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/oAuth2client.vm 2015-06-25 06:26:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/oAuth2client.vm 2015-06-25 07:57:12 +0000
@@ -59,6 +59,14 @@
<td><label for="name">$i18n.getString( "client_secret" )</label></td>
<td><input type="text" id="clientSecret" name="clientSecret" value="" #if($id)disabled#end></td>
</tr>
+ <tr>
+ <td><label for="name">$i18n.getString( "grant_types" )</label></td>
+ <td>
+ <input type="checkbox" id="gtPassword" name="gtPassword">Password<br/>
+ <input type="checkbox" id="gtRefreshToken" name="gtRefreshToken">Refresh Token<br/>
+ <input type="checkbox" id="gtAuthorizationCode" name="gtAuthorizationCode">Authorization Code<br/>
+ </td>
+ </tr>
</table>
#if( $id )