=== 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 @@ + + + + Password
+ Refresh Token
+ Authorization Code
+ + #if( $id )