modularized javascript loading and UI components
parent
00c4ea9199
commit
5af98e1106
|
@ -43,6 +43,7 @@
|
||||||
<value>resources/js/rsreg.js</value>
|
<value>resources/js/rsreg.js</value>
|
||||||
<value>resources/js/token.js</value>
|
<value>resources/js/token.js</value>
|
||||||
<value>resources/js/blacklist.js</value>
|
<value>resources/js/blacklist.js</value>
|
||||||
|
<value>resources/js/profile.js</value>
|
||||||
</set>
|
</set>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
|
|
@ -415,33 +415,6 @@ var ErrorHandlerView = Backbone.View.extend({
|
||||||
var AppRouter = Backbone.Router.extend({
|
var AppRouter = Backbone.Router.extend({
|
||||||
|
|
||||||
routes:{
|
routes:{
|
||||||
/*
|
|
||||||
"admin/clients":"listClients",
|
|
||||||
"admin/client/new":"newClient",
|
|
||||||
"admin/client/:id":"editClient",
|
|
||||||
|
|
||||||
"admin/whitelists":"whiteList",
|
|
||||||
"admin/whitelist/new/:cid":"newWhitelist",
|
|
||||||
"admin/whitelist/:id":"editWhitelist",
|
|
||||||
|
|
||||||
"admin/blacklist":"blackList",
|
|
||||||
|
|
||||||
"admin/scope":"siteScope",
|
|
||||||
"admin/scope/new":"newScope",
|
|
||||||
"admin/scope/:id":"editScope",
|
|
||||||
|
|
||||||
"user/approved":"approvedSites",
|
|
||||||
"user/tokens":"tokens",
|
|
||||||
"user/profile":"profile",
|
|
||||||
|
|
||||||
"dev/dynreg":"dynReg",
|
|
||||||
"dev/dynreg/new":"newDynReg",
|
|
||||||
"dev/dynreg/edit":"editDynReg",
|
|
||||||
|
|
||||||
"dev/resource":"resReg",
|
|
||||||
"dev/resource/new":"newResReg",
|
|
||||||
"dev/resource/edit":"editResReg",
|
|
||||||
*/
|
|
||||||
|
|
||||||
"": "root"
|
"": "root"
|
||||||
|
|
||||||
|
@ -476,147 +449,6 @@ var AppRouter = Backbone.Router.extend({
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
whiteList:function () {
|
|
||||||
|
|
||||||
if (!isAdmin()) {
|
|
||||||
this.root();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateSidebar('admin/whitelists');
|
|
||||||
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('whitelist.manage'), href:"manage/#admin/whitelists"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
var view = new WhiteListListView({model:this.whiteListList, clientList: this.clientList, systemScopeList: this.systemScopeList});
|
|
||||||
|
|
||||||
view.load(
|
|
||||||
function() {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
view.delegateEvents();
|
|
||||||
setPageTitle($.t('whitelist.manage'));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
newWhitelist:function(cid) {
|
|
||||||
|
|
||||||
if (!isAdmin()) {
|
|
||||||
this.root();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('whitelist.manage'), href:"manage/#admin/whitelists"},
|
|
||||||
{text:$.t('whitelist.new'), href:"manage/#admin/whitelist/new/" + cid}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('admin/whitelists');
|
|
||||||
|
|
||||||
var whiteList = new WhiteListModel();
|
|
||||||
|
|
||||||
var client = this.clientList.get(cid);
|
|
||||||
if (!client) {
|
|
||||||
client = new ClientModel({id: cid});
|
|
||||||
}
|
|
||||||
|
|
||||||
var view = new WhiteListFormView({model: whiteList, client: client, systemScopeList: this.systemScopeList});
|
|
||||||
|
|
||||||
view.load(
|
|
||||||
function() {
|
|
||||||
|
|
||||||
// set the scopes on the model now that everything's loaded
|
|
||||||
whiteList.set({allowedScopes: client.get('scope')}, {silent: true});
|
|
||||||
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
view.delegateEvents();
|
|
||||||
setPageTitle($.t('whitelist.manage'));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
editWhitelist:function(id) {
|
|
||||||
|
|
||||||
if (!isAdmin()) {
|
|
||||||
this.root();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('whitelist.manage'), href:"manage/#admin/whitelists"},
|
|
||||||
{text:$.t('whitelist.edit'), href:"manage/#admin/whitelist/" + id}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('admin/whitelists');
|
|
||||||
|
|
||||||
var whiteList = this.whiteListList.get(id);
|
|
||||||
if (!whiteList) {
|
|
||||||
whiteList = new WhiteListModel({id: id});
|
|
||||||
}
|
|
||||||
|
|
||||||
var view = new WhiteListFormView({model: whiteList, clientList: this.clientList, systemScopeList: this.systemScopeList});
|
|
||||||
|
|
||||||
view.load(
|
|
||||||
function() {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
view.delegateEvents();
|
|
||||||
setPageTitle($.t('whitelist.manage'));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
approvedSites:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('grant.manage-approved-sites'), href:"manage/#user/approve"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('user/approved');
|
|
||||||
|
|
||||||
var view = new ApprovedSiteListView({model:this.approvedSiteList, clientList: this.clientList, systemScopeList: this.systemScopeList});
|
|
||||||
view.load(
|
|
||||||
function(collection, response, options) {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
setPageTitle($.t('grant.manage-approved-sites'));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
tokens:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('token.manage'), href:"manage/#user/tokens"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('user/tokens');
|
|
||||||
|
|
||||||
var view = new TokenListView({model: {access: this.accessTokensList, refresh: this.refreshTokensList}, clientList: this.clientList, systemScopeList: this.systemScopeList});
|
|
||||||
|
|
||||||
view.load(
|
|
||||||
function(collection, response, options) {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
setPageTitle($.t('token.manage'));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
notImplemented:function(){
|
notImplemented:function(){
|
||||||
this.breadCrumbView.collection.reset();
|
this.breadCrumbView.collection.reset();
|
||||||
this.breadCrumbView.collection.add([
|
this.breadCrumbView.collection.add([
|
||||||
|
@ -627,281 +459,7 @@ var AppRouter = Backbone.Router.extend({
|
||||||
|
|
||||||
$('#content').html("<h2>Not implemented yet.</h2>");
|
$('#content').html("<h2>Not implemented yet.</h2>");
|
||||||
},
|
},
|
||||||
|
|
||||||
blackList:function() {
|
|
||||||
|
|
||||||
if (!isAdmin()) {
|
|
||||||
this.root();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('admin.manage-blacklist'), href:"manage/#admin/blacklist"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('admin/blacklist');
|
|
||||||
|
|
||||||
var view = new BlackListListView({collection: this.blackListList});
|
|
||||||
|
|
||||||
view.load(
|
|
||||||
function(collection, response, options) {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
setPageTitle($.t('admin.manage-blacklist'));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
siteScope:function() {
|
|
||||||
|
|
||||||
if (!isAdmin()) {
|
|
||||||
this.root();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('scope.manage'), href:"manage/#admin/scope"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('admin/scope');
|
|
||||||
|
|
||||||
var view = new SystemScopeListView({model:this.systemScopeList});
|
|
||||||
|
|
||||||
view.load(function() {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
view.delegateEvents();
|
|
||||||
setPageTitle($.t('scope.manage'));
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
newScope:function() {
|
|
||||||
|
|
||||||
if (!isAdmin()) {
|
|
||||||
this.root();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('scope.manage'), href:"manage/#admin/scope"},
|
|
||||||
{text:$.t('scope.system-scope-form.new'), href:"manage/#admin/scope/new"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('admin/scope');
|
|
||||||
|
|
||||||
var scope = new SystemScopeModel();
|
|
||||||
|
|
||||||
var view = new SystemScopeFormView({model:scope});
|
|
||||||
view.load(function() {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
setPageTitle($.t('scope.system-scope-form.new'));
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
editScope:function(sid) {
|
|
||||||
|
|
||||||
if (!isAdmin()) {
|
|
||||||
this.root();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('scope.manage'), href:"manage/#admin/scope"},
|
|
||||||
{text:$.t('scope.system-scope-form.edit'), href:"manage/#admin/scope/" + sid}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('admin/scope');
|
|
||||||
|
|
||||||
var scope = this.systemScopeList.get(sid);
|
|
||||||
if (!scope) {
|
|
||||||
scope = new SystemScopeModel({id: sid});
|
|
||||||
}
|
|
||||||
|
|
||||||
var view = new SystemScopeFormView({model:scope});
|
|
||||||
view.load(function() {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
setPageTitle($.t('scope.system-scope-form.new'));
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
dynReg:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('admin.self-service-client'), href:"manage/#dev/dynreg"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
var view = new DynRegRootView({systemScopeList: this.systemScopeList});
|
|
||||||
|
|
||||||
this.updateSidebar('dev/dynreg');
|
|
||||||
|
|
||||||
view.load(function() {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
|
|
||||||
setPageTitle($.t('admin.self-service-client'));
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
newDynReg:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('admin.self-service-client'), href:"manage/#dev/dynreg"},
|
|
||||||
{text:$.t('dynreg.new-client'), href:"manage/#dev/dynreg/new"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('dev/dynreg');
|
|
||||||
|
|
||||||
var client = new DynRegClient();
|
|
||||||
var view = new DynRegEditView({model: client, systemScopeList:this.systemScopeList});
|
|
||||||
|
|
||||||
view.load(function() {
|
|
||||||
|
|
||||||
var userInfo = getUserInfo();
|
|
||||||
var contacts = [];
|
|
||||||
if (userInfo != null && userInfo.email != null) {
|
|
||||||
contacts.push(userInfo.email);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (heartMode) {
|
|
||||||
client.set({
|
|
||||||
require_auth_time:true,
|
|
||||||
default_max_age:60000,
|
|
||||||
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
|
|
||||||
token_endpoint_auth_method: 'private_key_jwt',
|
|
||||||
grant_types: ["authorization_code"],
|
|
||||||
response_types: ["code"],
|
|
||||||
subject_type: "public",
|
|
||||||
contacts: contacts
|
|
||||||
}, { silent: true });
|
|
||||||
} else {
|
|
||||||
client.set({
|
|
||||||
require_auth_time:true,
|
|
||||||
default_max_age:60000,
|
|
||||||
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
|
|
||||||
token_endpoint_auth_method: 'client_secret_basic',
|
|
||||||
grant_types: ["authorization_code"],
|
|
||||||
response_types: ["code"],
|
|
||||||
subject_type: "public",
|
|
||||||
contacts: contacts
|
|
||||||
}, { silent: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
view.delegateEvents();
|
|
||||||
setPageTitle($.t('dynreg.new-client'));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
editDynReg:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('admin.self-service-client'), href:"manage/#dev/dynreg"},
|
|
||||||
{text:$.t('dynreg.edit-existing'), href:"manage/#dev/dynreg/edit"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('dev/dynreg');
|
|
||||||
|
|
||||||
setPageTitle($.t('dynreg.edit-existing'));
|
|
||||||
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
|
|
||||||
},
|
|
||||||
|
|
||||||
resReg:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('admin.self-service-resource'), href:"manage/#dev/resource"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('dev/resource');
|
|
||||||
|
|
||||||
var view = new ResRegRootView({systemScopeList: this.systemScopeList});
|
|
||||||
view.load(function() {
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
|
|
||||||
setPageTitle($.t('admin.self-service-resource'));
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
newResReg:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('admin.self-service-resource'), href:"manage/#dev/resource"},
|
|
||||||
{text:$.t('rsreg.new'), href:"manage/#dev/resource/new"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('dev/resource');
|
|
||||||
|
|
||||||
var client = new ResRegClient();
|
|
||||||
var view = new ResRegEditView({model: client, systemScopeList:this.systemScopeList});
|
|
||||||
|
|
||||||
view.load(function() {
|
|
||||||
|
|
||||||
var userInfo = getUserInfo();
|
|
||||||
var contacts = [];
|
|
||||||
if (userInfo != null && userInfo.email != null) {
|
|
||||||
contacts.push(userInfo.email);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.set({
|
|
||||||
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
|
|
||||||
token_endpoint_auth_method: 'client_secret_basic',
|
|
||||||
contacts: contacts
|
|
||||||
}, { silent: true });
|
|
||||||
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
view.delegateEvents();
|
|
||||||
setPageTitle($.t('rsreg.new'));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
editResReg:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('admin.self-service-resource'), href:"manage/#dev/resource"},
|
|
||||||
{text:$.t('rsreg.edit'), href:"manage/#dev/resource/edit"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('dev/resource');
|
|
||||||
|
|
||||||
setPageTitle($.t('rsreg.edit'));
|
|
||||||
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
|
|
||||||
},
|
|
||||||
|
|
||||||
profile:function() {
|
|
||||||
this.breadCrumbView.collection.reset();
|
|
||||||
this.breadCrumbView.collection.add([
|
|
||||||
{text:$.t('admin.home'), href:""},
|
|
||||||
{text:$.t('admin.user-profile.show'), href:"manage/#user/profile"}
|
|
||||||
]);
|
|
||||||
|
|
||||||
this.updateSidebar('user/profile');
|
|
||||||
|
|
||||||
var view = new UserProfileView({model: getUserInfo()});
|
|
||||||
$('#content').html(view.render().el);
|
|
||||||
|
|
||||||
setPageTitle($.t('admin.user-profile.show'));
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
updateSidebar:function(item) {
|
updateSidebar:function(item) {
|
||||||
$('.sidebar-nav li.active').removeClass('active');
|
$('.sidebar-nav li.active').removeClass('active');
|
||||||
|
|
||||||
|
@ -935,8 +493,6 @@ $(function () {
|
||||||
$.ajaxSetup({cache:false});
|
$.ajaxSetup({cache:false});
|
||||||
app = new AppRouter();
|
app = new AppRouter();
|
||||||
|
|
||||||
console.log(ui.routes);
|
|
||||||
|
|
||||||
_.each(ui.routes.reverse(), function(route) {
|
_.each(ui.routes.reverse(), function(route) {
|
||||||
console.log("Adding route: " + route.name);
|
console.log("Adding route: " + route.name);
|
||||||
app.route(route.path, route.name, route.callback);
|
app.route(route.path, route.name, route.callback);
|
||||||
|
|
|
@ -180,3 +180,31 @@ var BlackListWidgetView = Backbone.View.extend({
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ui.routes.push({path: "admin/blacklist", name: "blackList", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
if (!isAdmin()) {
|
||||||
|
this.root();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('admin.manage-blacklist'), href:"manage/#admin/blacklist"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('admin/blacklist');
|
||||||
|
|
||||||
|
var view = new BlackListListView({collection: this.blackListList});
|
||||||
|
|
||||||
|
view.load(
|
||||||
|
function(collection, response, options) {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
setPageTitle($.t('admin.manage-blacklist'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
@ -611,3 +611,98 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "dev/dynreg", name: "dynReg", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('admin.self-service-client'), href:"manage/#dev/dynreg"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
var view = new DynRegRootView({systemScopeList: this.systemScopeList});
|
||||||
|
|
||||||
|
this.updateSidebar('dev/dynreg');
|
||||||
|
|
||||||
|
view.load(function() {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
|
||||||
|
setPageTitle($.t('admin.self-service-client'));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "dev/dynreg/new", name: "newDynReg", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('admin.self-service-client'), href:"manage/#dev/dynreg"},
|
||||||
|
{text:$.t('dynreg.new-client'), href:"manage/#dev/dynreg/new"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('dev/dynreg');
|
||||||
|
|
||||||
|
var client = new DynRegClient();
|
||||||
|
var view = new DynRegEditView({model: client, systemScopeList:this.systemScopeList});
|
||||||
|
|
||||||
|
view.load(function() {
|
||||||
|
|
||||||
|
var userInfo = getUserInfo();
|
||||||
|
var contacts = [];
|
||||||
|
if (userInfo != null && userInfo.email != null) {
|
||||||
|
contacts.push(userInfo.email);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (heartMode) {
|
||||||
|
client.set({
|
||||||
|
require_auth_time:true,
|
||||||
|
default_max_age:60000,
|
||||||
|
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
|
||||||
|
token_endpoint_auth_method: 'private_key_jwt',
|
||||||
|
grant_types: ["authorization_code"],
|
||||||
|
response_types: ["code"],
|
||||||
|
subject_type: "public",
|
||||||
|
contacts: contacts
|
||||||
|
}, { silent: true });
|
||||||
|
} else {
|
||||||
|
client.set({
|
||||||
|
require_auth_time:true,
|
||||||
|
default_max_age:60000,
|
||||||
|
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
|
||||||
|
token_endpoint_auth_method: 'client_secret_basic',
|
||||||
|
grant_types: ["authorization_code"],
|
||||||
|
response_types: ["code"],
|
||||||
|
subject_type: "public",
|
||||||
|
contacts: contacts
|
||||||
|
}, { silent: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
view.delegateEvents();
|
||||||
|
setPageTitle($.t('dynreg.new-client'));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "dev/dynreg/edit", name: "editDynReg", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('admin.self-service-client'), href:"manage/#dev/dynreg"},
|
||||||
|
{text:$.t('dynreg.edit-existing'), href:"manage/#dev/dynreg/edit"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('dev/dynreg');
|
||||||
|
|
||||||
|
setPageTitle($.t('dynreg.edit-existing'));
|
||||||
|
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
|
||||||
|
}
|
||||||
|
});
|
|
@ -258,3 +258,23 @@ var ApprovedSiteView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "user/approved", name: "approvedSites", callback:
|
||||||
|
|
||||||
|
function() {
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('grant.manage-approved-sites'), href:"manage/#user/approve"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('user/approved');
|
||||||
|
|
||||||
|
var view = new ApprovedSiteListView({model:this.approvedSiteList, clientList: this.clientList, systemScopeList: this.systemScopeList});
|
||||||
|
view.load(
|
||||||
|
function(collection, response, options) {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
setPageTitle($.t('grant.manage-approved-sites'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
ui.routes.push({path: "user/profile", name: "profile", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('admin.user-profile.show'), href:"manage/#user/profile"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('user/profile');
|
||||||
|
|
||||||
|
var view = new UserProfileView({model: getUserInfo()});
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
|
||||||
|
setPageTitle($.t('admin.user-profile.show'));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
|
@ -426,4 +426,80 @@ var ResRegEditView = Backbone.View.extend({
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "dev/resource", name: "resReg", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('admin.self-service-resource'), href:"manage/#dev/resource"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('dev/resource');
|
||||||
|
|
||||||
|
var view = new ResRegRootView({systemScopeList: this.systemScopeList});
|
||||||
|
view.load(function() {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
|
||||||
|
setPageTitle($.t('admin.self-service-resource'));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "dev/resource/new", name: "newResReg", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('admin.self-service-resource'), href:"manage/#dev/resource"},
|
||||||
|
{text:$.t('rsreg.new'), href:"manage/#dev/resource/new"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('dev/resource');
|
||||||
|
|
||||||
|
var client = new ResRegClient();
|
||||||
|
var view = new ResRegEditView({model: client, systemScopeList:this.systemScopeList});
|
||||||
|
|
||||||
|
view.load(function() {
|
||||||
|
|
||||||
|
var userInfo = getUserInfo();
|
||||||
|
var contacts = [];
|
||||||
|
if (userInfo != null && userInfo.email != null) {
|
||||||
|
contacts.push(userInfo.email);
|
||||||
|
}
|
||||||
|
|
||||||
|
client.set({
|
||||||
|
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
|
||||||
|
token_endpoint_auth_method: 'client_secret_basic',
|
||||||
|
contacts: contacts
|
||||||
|
}, { silent: true });
|
||||||
|
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
view.delegateEvents();
|
||||||
|
setPageTitle($.t('rsreg.new'));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "dev/resource/edit", name: "editResReg", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('admin.self-service-resource'), href:"manage/#dev/resource"},
|
||||||
|
{text:$.t('rsreg.edit'), href:"manage/#dev/resource/edit"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('dev/resource');
|
||||||
|
|
||||||
|
setPageTitle($.t('rsreg.edit'));
|
||||||
|
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -99,8 +99,8 @@ var SystemScopeView = Backbone.View.extend({
|
||||||
$('.restricted', this.el).tooltip({title: $.t('scope.system-scope-table.tooltip-restricted')});
|
$('.restricted', this.el).tooltip({title: $.t('scope.system-scope-table.tooltip-restricted')});
|
||||||
$('.default', this.el).tooltip({title: $.t('scope.system-scope-table.tooltip-default')});
|
$('.default', this.el).tooltip({title: $.t('scope.system-scope-table.tooltip-default')});
|
||||||
|
|
||||||
return this;
|
|
||||||
$(this.el).i18n();
|
$(this.el).i18n();
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteScope:function (e) {
|
deleteScope:function (e) {
|
||||||
|
@ -346,3 +346,90 @@ var SystemScopeFormView = Backbone.View.extend({
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "admin/scope", name: "siteScope", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
if (!isAdmin()) {
|
||||||
|
this.root();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('scope.manage'), href:"manage/#admin/scope"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('admin/scope');
|
||||||
|
|
||||||
|
var view = new SystemScopeListView({model:this.systemScopeList});
|
||||||
|
|
||||||
|
view.load(function() {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
view.delegateEvents();
|
||||||
|
setPageTitle($.t('scope.manage'));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "admin/scope/new", name:"newScope", callback:
|
||||||
|
function() {
|
||||||
|
|
||||||
|
|
||||||
|
if (!isAdmin()) {
|
||||||
|
this.root();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('scope.manage'), href:"manage/#admin/scope"},
|
||||||
|
{text:$.t('scope.system-scope-form.new'), href:"manage/#admin/scope/new"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('admin/scope');
|
||||||
|
|
||||||
|
var scope = new SystemScopeModel();
|
||||||
|
|
||||||
|
var view = new SystemScopeFormView({model:scope});
|
||||||
|
view.load(function() {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
setPageTitle($.t('scope.system-scope-form.new'));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "admin/scope/:id", name: "editScope", callback:
|
||||||
|
function(sid) {
|
||||||
|
|
||||||
|
if (!isAdmin()) {
|
||||||
|
this.root();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('scope.manage'), href:"manage/#admin/scope"},
|
||||||
|
{text:$.t('scope.system-scope-form.edit'), href:"manage/#admin/scope/" + sid}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('admin/scope');
|
||||||
|
|
||||||
|
var scope = this.systemScopeList.get(sid);
|
||||||
|
if (!scope) {
|
||||||
|
scope = new SystemScopeModel({id: sid});
|
||||||
|
}
|
||||||
|
|
||||||
|
var view = new SystemScopeFormView({model:scope});
|
||||||
|
view.load(function() {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
setPageTitle($.t('scope.system-scope-form.new'));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
|
@ -477,3 +477,26 @@ var TokenListView = Backbone.View.extend({
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ui.routes.push({path: "user/tokens", name: "tokens", callback:
|
||||||
|
function() {
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('token.manage'), href:"manage/#user/tokens"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('user/tokens');
|
||||||
|
|
||||||
|
var view = new TokenListView({model: {access: this.accessTokensList, refresh: this.refreshTokensList}, clientList: this.clientList, systemScopeList: this.systemScopeList});
|
||||||
|
|
||||||
|
view.load(
|
||||||
|
function(collection, response, options) {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
setPageTitle($.t('token.manage'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
|
@ -389,3 +389,112 @@ var WhiteListFormView = Backbone.View.extend({
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ui.routes.push({path: "admin/whitelists", name: "whiteList", callback:
|
||||||
|
function () {
|
||||||
|
|
||||||
|
if (!isAdmin()) {
|
||||||
|
this.root();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateSidebar('admin/whitelists');
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('whitelist.manage'), href:"manage/#admin/whitelists"}
|
||||||
|
]);
|
||||||
|
|
||||||
|
var view = new WhiteListListView({model:this.whiteListList, clientList: this.clientList, systemScopeList: this.systemScopeList});
|
||||||
|
|
||||||
|
view.load(
|
||||||
|
function() {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
view.delegateEvents();
|
||||||
|
setPageTitle($.t('whitelist.manage'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.routes.push({path: "admin/whitelist/new/:cid", name: "newWhitelist", callback:
|
||||||
|
function(cid) {
|
||||||
|
|
||||||
|
|
||||||
|
if (!isAdmin()) {
|
||||||
|
this.root();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('whitelist.manage'), href:"manage/#admin/whitelists"},
|
||||||
|
{text:$.t('whitelist.new'), href:"manage/#admin/whitelist/new/" + cid}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('admin/whitelists');
|
||||||
|
|
||||||
|
var whiteList = new WhiteListModel();
|
||||||
|
|
||||||
|
var client = this.clientList.get(cid);
|
||||||
|
if (!client) {
|
||||||
|
client = new ClientModel({id: cid});
|
||||||
|
}
|
||||||
|
|
||||||
|
var view = new WhiteListFormView({model: whiteList, client: client, systemScopeList: this.systemScopeList});
|
||||||
|
|
||||||
|
view.load(
|
||||||
|
function() {
|
||||||
|
|
||||||
|
// set the scopes on the model now that everything's loaded
|
||||||
|
whiteList.set({allowedScopes: client.get('scope')}, {silent: true});
|
||||||
|
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
view.delegateEvents();
|
||||||
|
setPageTitle($.t('whitelist.manage'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ui.routes.push({path: "admin/whitelist/:id", name: "editWhitelist", callback:
|
||||||
|
function(id) {
|
||||||
|
|
||||||
|
if (!isAdmin()) {
|
||||||
|
this.root();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.breadCrumbView.collection.reset();
|
||||||
|
this.breadCrumbView.collection.add([
|
||||||
|
{text:$.t('admin.home'), href:""},
|
||||||
|
{text:$.t('whitelist.manage'), href:"manage/#admin/whitelists"},
|
||||||
|
{text:$.t('whitelist.edit'), href:"manage/#admin/whitelist/" + id}
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.updateSidebar('admin/whitelists');
|
||||||
|
|
||||||
|
var whiteList = this.whiteListList.get(id);
|
||||||
|
if (!whiteList) {
|
||||||
|
whiteList = new WhiteListModel({id: id});
|
||||||
|
}
|
||||||
|
|
||||||
|
var view = new WhiteListFormView({model: whiteList, clientList: this.clientList, systemScopeList: this.systemScopeList});
|
||||||
|
|
||||||
|
view.load(
|
||||||
|
function() {
|
||||||
|
$('#content').html(view.render().el);
|
||||||
|
view.delegateEvents();
|
||||||
|
setPageTitle($.t('whitelist.manage'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue