diff --git a/uma-server-webapp/src/main/webapp/resources/js/admin.js b/uma-server-webapp/src/main/webapp/resources/js/admin.js index a23fe3fb9..3637b1091 100644 --- a/uma-server-webapp/src/main/webapp/resources/js/admin.js +++ b/uma-server-webapp/src/main/webapp/resources/js/admin.js @@ -1109,13 +1109,15 @@ var AppRouter = Backbone.Router.extend({ this.updateSidebar('user/policy'); var rs = this.resourceSetList.get(rsid); + var policies = null; if (rs == null) { // need to load it directly - var policies = new PolicyCollection([], {rsid: rsid}); + policies = new PolicyCollection([], {rsid: rsid}); + rs = new ResourceSetModel({id: rsid}); } else { // the resource set is loaded, preload the claims - var policies = new PolicyCollection(rs.get('policies'), {rsid: rsid}); - policy.isFetched = true; + policies = new PolicyCollection(rs.get('policies'), {rsid: rsid}); + policies.isFetched = true; } var view = new PolicyListView({model: policies, rs: rs, systemScopeList: this.systemScopeList}); diff --git a/uma-server-webapp/src/main/webapp/resources/js/policy.js b/uma-server-webapp/src/main/webapp/resources/js/policy.js index 7d56ef8d8..1550aa0e6 100644 --- a/uma-server-webapp/src/main/webapp/resources/js/policy.js +++ b/uma-server-webapp/src/main/webapp/resources/js/policy.js @@ -16,17 +16,17 @@ *******************************************************************************/ var ResourceSetModel = Backbone.Model.extend({ - + urlRoot: 'api/resourceset' }); var ResourceSetCollection = Backbone.Collection.extend({ model: ResourceSetModel, - url: 'api/policy' + url: 'api/resourceset' }); var PolicyModel = Backbone.Model.extend({ urlRoot: function() { - return 'api/policy/' + this.options.rsid + '/'; + return 'api/resourceset/' + this.options.rsid + '/policy/'; }, initialize: function(model, options) { this.options = options; @@ -36,7 +36,7 @@ var PolicyModel = Backbone.Model.extend({ var PolicyCollection = Backbone.Collection.extend({ model: PolicyModel, url: function() { - return 'api/policy/' + this.options.rsid; + return 'api/resourceset/' + this.options.rsid + '/policy/'; }, initialize: function(models, options) { this.options = options; @@ -352,6 +352,11 @@ var PolicyView = Backbone.View.extend({ this.template = _.template($('#tmpl-policy').html()); } + if (!this.scopeTemplate) { + this.scopeTemplate = _.template($('#tmpl-scope-list').html()); + } + + }, events:{ @@ -448,8 +453,9 @@ var PolicyFormView = Backbone.View.extend({ render:function (eventName) { var json = this.model.toJSON(); + var rs = this.options.rs.toJSON(); - this.$el.html(this.template({policy: json, rs: this.options.rs})); + this.$el.html(this.template({policy: json, rs: rs})); return this; } diff --git a/uma-server-webapp/src/main/webapp/resources/template/policy.html b/uma-server-webapp/src/main/webapp/resources/template/policy.html index 45b83a6aa..a12320066 100644 --- a/uma-server-webapp/src/main/webapp/resources/template/policy.html +++ b/uma-server-webapp/src/main/webapp/resources/template/policy.html @@ -163,6 +163,7 @@