diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/locale/en/messages.json b/openid-connect-server-webapp/src/main/webapp/resources/js/locale/en/messages.json index 4901183a9..af7d3c011 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/locale/en/messages.json +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/locale/en/messages.json @@ -345,9 +345,14 @@ "required-claims": "Required Claims", "policy-table": { "edit": "Edit Policies", + "email-address": "email address", + "required-claims": "Users that you share this resource will with need to be able to present the following claims in order to access the resource.", "no-resource-sets": "There are no resource sets registered. Introduce a protected to this authorization server to let it register some.", - "no-required-claims": "There are no required claims for this resource set.", - "share-email": "Share with email address" + "no-required-claims": "There are no required claims for this resource set: This resource set is inaccessible by others.", + "share-email": "Share with email address", + "issuers": "Issuers", + "claim": "Claim", + "value": "Value" } }, "copyright": "Powered by MITREid Connect {0} © 2015 The MITRE Corporation and MIT KIT..", diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/policy.js b/openid-connect-server-webapp/src/main/webapp/resources/js/policy.js index ca120b3f4..1ce677a84 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/policy.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/policy.js @@ -211,7 +211,48 @@ var ClaimListView = Backbone.View.extend({ }); }, - togglePlaceholder:function() { + events:{ + 'click .btn-save':'savePolicy', + 'click .btn-cancel':'cancel', + 'click .btn-share':'addClaim' + }, + + cancel:function(e) { + e.preventDefault(); + app.navigate('user/policy', {trigger: true}); + }, + + savePolicy:function(e) { + e.preventDefault(); + + var _self = this; + + console.log(this); + + this.model.sync('update', this.model, { + success:function() { + app.navigate('user/policy', {trigger: true}); + }, + error:function (error, response) { + console.log("An error occurred when saving a policy set"); + + //Pull out the response text. + var responseJson = JSON.parse(response.responseText); + + //Display an alert with an error message + $('#modalAlert div.modal-header').html(responseJson.error); + $('#modalAlert div.modal-body').html(responseJson.error_description); + + $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog + "backdrop" : "static", + "keyboard" : true, + "show" : true // ensure the modal is shown immediately + }); + } + }); + }, + + togglePlaceholder:function() { if (this.model.length > 0) { $('#required-claim-table', this.el).show(); $('#required-claim-table-empty', this.el).hide(); @@ -252,6 +293,26 @@ var ClaimView = Backbone.View.extend({ } }, + events:{ + 'click .btn-remove':'removeClaim' + }, + + removeClaim:function(e) { + e.preventDefault(); + + var _self = this; + + this.model.collection.remove(this.model); + _self.$el.fadeTo("fast", 0.00, function () { //fade + $(this).slideUp("fast", function () { //slide up + $(this).remove(); //then remove from the DOM + _self.parentView.togglePlaceholder(); + }); + }); + + + }, + render:function (eventName) { var json = this.model.toJSON(); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/template/policy.html b/openid-connect-server-webapp/src/main/webapp/resources/template/policy.html index daa3e96d2..b4295ad1b 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/template/policy.html +++ b/openid-connect-server-webapp/src/main/webapp/resources/template/policy.html @@ -63,25 +63,29 @@ -
- There are no required claims for this resource set. -
-
- +
+
+ Users that you share this resource will with need to be able to present the following claims in order to access the resource. +
+ +
+ There are no required claims for this resource set: This resource set is inaccessible by others. +
+ - - - + + +
IssuersClaimValueIssuersClaimValue