|
|
@ -165,8 +165,6 @@ var ListWidgetView = Backbone.View.extend({ |
|
|
|
|
|
|
|
|
|
|
|
tagName: "div", |
|
|
|
tagName: "div", |
|
|
|
|
|
|
|
|
|
|
|
childView:ListWidgetChildView, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
events:{ |
|
|
|
events:{ |
|
|
|
"click .btn-add-list-item":"addItem", |
|
|
|
"click .btn-add-list-item":"addItem", |
|
|
|
"keypress":function (e) { |
|
|
|
"keypress":function (e) { |
|
|
@ -226,7 +224,7 @@ var ListWidgetView = Backbone.View.extend({ |
|
|
|
this.$el.html(this.template({placeholder:this.options.placeholder, |
|
|
|
this.$el.html(this.template({placeholder:this.options.placeholder, |
|
|
|
helpBlockText:this.options.helpBlockText})); |
|
|
|
helpBlockText:this.options.helpBlockText})); |
|
|
|
|
|
|
|
|
|
|
|
_self = this; |
|
|
|
var _self = this; |
|
|
|
|
|
|
|
|
|
|
|
if (_.size(this.collection.models) == 0 && _.size(this.options.autocomplete) == 0) { |
|
|
|
if (_.size(this.collection.models) == 0 && _.size(this.options.autocomplete) == 0) { |
|
|
|
$("tbody", _self.el).html($('#tmpl-list-widget-child-empty').html()); |
|
|
|
$("tbody", _self.el).html($('#tmpl-list-widget-child-empty').html()); |
|
|
@ -256,7 +254,7 @@ var ListWidgetView = Backbone.View.extend({ |
|
|
|
checked = false; |
|
|
|
checked = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var el = new this.childView({model:model, toggle: true, checked: checked, collection: _self.collection}).render().el; |
|
|
|
var el = new ListWidgetChildView({model:model, toggle: true, checked: checked, collection: _self.collection}).render().el; |
|
|
|
$("tbody", _self.el).append(el); |
|
|
|
$("tbody", _self.el).append(el); |
|
|
|
|
|
|
|
|
|
|
|
}, this); |
|
|
|
}, this); |
|
|
@ -265,8 +263,7 @@ var ListWidgetView = Backbone.View.extend({ |
|
|
|
|
|
|
|
|
|
|
|
// now render everything not in the autocomplete list
|
|
|
|
// now render everything not in the autocomplete list
|
|
|
|
_.each(values.models, function (model) { |
|
|
|
_.each(values.models, function (model) { |
|
|
|
|
|
|
|
var el = new ListWidgetChildView({model:model, collection: _self.collection}).render().el; |
|
|
|
var el = new this.childView({model:model, collection: _self.collection}).render().el; |
|
|
|
|
|
|
|
$("tbody", _self.el).append(el); |
|
|
|
$("tbody", _self.el).append(el); |
|
|
|
}, this); |
|
|
|
}, this); |
|
|
|
} |
|
|
|
} |
|
|
@ -277,18 +274,6 @@ var ListWidgetView = Backbone.View.extend({ |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var BlackListModel = Backbone.Model.extend({ |
|
|
|
|
|
|
|
idAttribute: 'id', |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
urlRoot: 'api/blacklist' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BlackListCollection = Backbone.Collection.extend({ |
|
|
|
|
|
|
|
initialize: function() { }, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
url: "api/blacklist" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BreadCrumbView = Backbone.View.extend({ |
|
|
|
var BreadCrumbView = Backbone.View.extend({ |
|
|
|
|
|
|
|
|
|
|
|
tagName: 'ul', |
|
|
|
tagName: 'ul', |
|
|
@ -329,125 +314,6 @@ var BreadCrumbView = Backbone.View.extend({ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BlackListListView = Backbone.View.extend({ |
|
|
|
|
|
|
|
tagName: 'span', |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialize:function(options) { |
|
|
|
|
|
|
|
this.options = options; |
|
|
|
|
|
|
|
if (!this.template) { |
|
|
|
|
|
|
|
this.template = _.template($('#tmpl-blacklist-form').html()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
load:function(callback) { |
|
|
|
|
|
|
|
if (this.model.isFetched) { |
|
|
|
|
|
|
|
callback(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#loadingbox').sheet('show'); |
|
|
|
|
|
|
|
$('#loading').html( |
|
|
|
|
|
|
|
'<span class="label" id="loading-blacklist">' + $.t('admin.blacklist') + '</span> ' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.when(this.model.fetchIfNeeded()).done(function() { |
|
|
|
|
|
|
|
$('#loading-blacklist').addClass('label-success'); |
|
|
|
|
|
|
|
$('#loadingbox').sheet('hide'); |
|
|
|
|
|
|
|
callback(); |
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
events: { |
|
|
|
|
|
|
|
"click .refresh-table":"refreshTable"
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
refreshTable:function(e) { |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
var _self = this; |
|
|
|
|
|
|
|
$('#loadingbox').sheet('show'); |
|
|
|
|
|
|
|
$('#loading').html( |
|
|
|
|
|
|
|
'<span class="label" id="loading-blacklist">' + $.t('admin.blacklist') + '</span> ' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.when(this.model.fetch()).done(function() { |
|
|
|
|
|
|
|
$('#loadingbox').sheet('hide'); |
|
|
|
|
|
|
|
_self.render(); |
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render:function (eventName) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(this.el).html(this.template(this.model.toJSON())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#blacklist .controls', this.el).html(new BlackListWidgetView({ |
|
|
|
|
|
|
|
type: 'uri', |
|
|
|
|
|
|
|
placeholder: 'http://', |
|
|
|
|
|
|
|
collection: this.model |
|
|
|
|
|
|
|
}).render().el); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(this.el).i18n(); |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BlackListWidgetView = ListWidgetView.extend({ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
childView: ListWidgetChildView.extend({ |
|
|
|
|
|
|
|
render:function(options) { |
|
|
|
|
|
|
|
this.options = options; |
|
|
|
|
|
|
|
var uri = this.model.get('uri'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$el.html(this.template({item: uri})); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uri.length > 30) { |
|
|
|
|
|
|
|
this.$el.tooltip({title:uri}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addItem:function(e) { |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var input_value = $("input", this.el).val().trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (input_value === "") { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: URI/pattern validation, check against existing clients
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var item = new BlackListModel({ |
|
|
|
|
|
|
|
uri: input_value |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _self = this; // closures...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.save({}, { |
|
|
|
|
|
|
|
success:function() { |
|
|
|
|
|
|
|
_self.collection.add(item); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
error:function(error, response) { |
|
|
|
|
|
|
|
//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
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stats table
|
|
|
|
// Stats table
|
|
|
|
|
|
|
|
|
|
|
|
var StatsModel = Backbone.Model.extend({ |
|
|
|
var StatsModel = Backbone.Model.extend({ |
|
|
@ -470,12 +336,29 @@ var UserProfileView = Backbone.View.extend({ |
|
|
|
|
|
|
|
|
|
|
|
$(this.el).html($('#tmpl-user-profile').html()); |
|
|
|
$(this.el).html($('#tmpl-user-profile').html()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var t = this.template; |
|
|
|
|
|
|
|
|
|
|
|
_.each(this.model, function (value, key) { |
|
|
|
_.each(this.model, function (value, key) { |
|
|
|
if (key && value) { |
|
|
|
if (key && value) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof(value) === 'object') { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var el = this.el; |
|
|
|
|
|
|
|
var k = key; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_.each(value, function (value, key) { |
|
|
|
|
|
|
|
$('dl', el).append( |
|
|
|
|
|
|
|
t({key: key, value: value, category: k}) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else if (typeof(value) === 'array') { |
|
|
|
|
|
|
|
// TODO: handle array types
|
|
|
|
|
|
|
|
} else { |
|
|
|
$('dl', this.el).append( |
|
|
|
$('dl', this.el).append( |
|
|
|
this.template({key: key, value: value}) |
|
|
|
t({key: key, value: value}) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, this); |
|
|
|
}, this); |
|
|
|
|
|
|
|
|
|
|
|
$(this.el).i18n(); |
|
|
|
$(this.el).i18n(); |
|
|
@ -621,6 +504,7 @@ var AppRouter = Backbone.Router.extend({ |
|
|
|
grantTypes: ["authorization_code"], |
|
|
|
grantTypes: ["authorization_code"], |
|
|
|
responseTypes: ["code"], |
|
|
|
responseTypes: ["code"], |
|
|
|
subjectType: "PUBLIC", |
|
|
|
subjectType: "PUBLIC", |
|
|
|
|
|
|
|
jwksType: "URI", |
|
|
|
contacts: contacts |
|
|
|
contacts: contacts |
|
|
|
}, { silent: true }); |
|
|
|
}, { silent: true }); |
|
|
|
|
|
|
|
|
|
|
@ -659,6 +543,16 @@ var AppRouter = Backbone.Router.extend({ |
|
|
|
}, { silent: true }); |
|
|
|
}, { silent: true }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (client.get("jwks")) { |
|
|
|
|
|
|
|
client.set({ |
|
|
|
|
|
|
|
jwksType: "VAL" |
|
|
|
|
|
|
|
}, { silent: true }); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
client.set({ |
|
|
|
|
|
|
|
jwksType: "URI" |
|
|
|
|
|
|
|
}, { silent: true }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
client.set({ |
|
|
|
client.set({ |
|
|
|
generateClientSecret:false, |
|
|
|
generateClientSecret:false, |
|
|
|
displayClientSecret:false |
|
|
|
displayClientSecret:false |
|
|
@ -780,7 +674,6 @@ var AppRouter = Backbone.Router.extend({ |
|
|
|
this.updateSidebar('user/approved'); |
|
|
|
this.updateSidebar('user/approved'); |
|
|
|
|
|
|
|
|
|
|
|
var view = new ApprovedSiteListView({model:this.approvedSiteList, clientList: this.clientList, systemScopeList: this.systemScopeList}); |
|
|
|
var view = new ApprovedSiteListView({model:this.approvedSiteList, clientList: this.clientList, systemScopeList: this.systemScopeList}); |
|
|
|
|
|
|
|
|
|
|
|
view.load(
|
|
|
|
view.load(
|
|
|
|
function(collection, response, options) { |
|
|
|
function(collection, response, options) { |
|
|
|
$('#content').html(view.render().el); |
|
|
|
$('#content').html(view.render().el); |
|
|
@ -836,7 +729,7 @@ var AppRouter = Backbone.Router.extend({ |
|
|
|
|
|
|
|
|
|
|
|
this.updateSidebar('admin/blacklist'); |
|
|
|
this.updateSidebar('admin/blacklist'); |
|
|
|
|
|
|
|
|
|
|
|
var view = new BlackListListView({model:this.blackListList}); |
|
|
|
var view = new BlackListListView({collection: this.blackListList}); |
|
|
|
|
|
|
|
|
|
|
|
view.load( |
|
|
|
view.load( |
|
|
|
function(collection, response, options) { |
|
|
|
function(collection, response, options) { |
|
|
@ -1230,11 +1123,17 @@ $(function () { |
|
|
|
$.get('resources/template/dynreg.html', _load), |
|
|
|
$.get('resources/template/dynreg.html', _load), |
|
|
|
$.get('resources/template/rsreg.html', _load), |
|
|
|
$.get('resources/template/rsreg.html', _load), |
|
|
|
$.get('resources/template/token.html', _load), |
|
|
|
$.get('resources/template/token.html', _load), |
|
|
|
|
|
|
|
$.get('resources/template/blacklist.html', _load), |
|
|
|
$.get('resources/template/policy.html', _load) |
|
|
|
$.get('resources/template/policy.html', _load) |
|
|
|
).done(function() { |
|
|
|
).done(function() { |
|
|
|
$.ajaxSetup({cache:false}); |
|
|
|
$.ajaxSetup({cache:false}); |
|
|
|
app = new AppRouter(); |
|
|
|
app = new AppRouter(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.on('route', function(name, args) { |
|
|
|
|
|
|
|
// scroll to top of page on new route selection
|
|
|
|
|
|
|
|
$("html, body").animate({ scrollTop: 0 }, "slow"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// grab all hashed URLs and send them through the app router instead
|
|
|
|
// grab all hashed URLs and send them through the app router instead
|
|
|
|
$(document).on('click', 'a[href^="manage/#"]', function(event) { |
|
|
|
$(document).on('click', 'a[href^="manage/#"]', function(event) { |
|
|
|
event.preventDefault(); |
|
|
|
event.preventDefault(); |
|
|
|