modularized UMA server UI

pull/1192/merge
Justin Richer 2017-02-20 14:07:01 -05:00
parent f2173907ac
commit 9592c784d1
4 changed files with 198 additions and 1280 deletions

View File

@ -1,39 +0,0 @@
<%@ attribute name="js" required="false"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="o" tagdir="/WEB-INF/tags"%>
<div id="push"></div>
</div>
<!-- end #wrap -->
<div id="footer">
<div class="container">
<p class="muted credit">
<o:copyright />
</p>
</div>
</div>
<!-- javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="resources/bootstrap2/js/bootstrap.js"></script>
<script type="text/javascript" src="resources/js/lib/underscore.js"></script>
<script type="text/javascript" src="resources/js/lib/backbone.js"></script>
<script type="text/javascript" src="resources/js/lib/purl.js"></script>
<script type="text/javascript" src="resources/js/lib/bootstrapx-clickover.js"></script>
<script type="text/javascript" src="resources/js/lib/bootstrap-sheet.js"></script>
<script type="text/javascript" src="resources/js/lib/bootpag.js"></script>
<c:if test="${js != null && js != ''}">
<script type="text/javascript" src="resources/js/client.js"></script>
<script type="text/javascript" src="resources/js/grant.js"></script>
<script type="text/javascript" src="resources/js/scope.js"></script>
<script type="text/javascript" src="resources/js/whitelist.js"></script>
<script type="text/javascript" src="resources/js/dynreg.js"></script>
<script type="text/javascript" src="resources/js/rsreg.js"></script>
<script type="text/javascript" src="resources/js/token.js"></script>
<script type="text/javascript" src="resources/js/blacklist.js"></script>
<script type="text/javascript" src="resources/js/policy.js"></script>
<script type="text/javascript" src="resources/js/admin.js"></script>
</c:if>
<script type="text/javascript" src="resources/js/lib/retina.js"></script>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2017 The MITRE Corporation
and the MIT Internet Trust Consortium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<!-- This file allows you to define components to the UI -->
<bean class="org.mitre.openid.connect.config.UIConfiguration" id="uiConfiguration">
<property name="jsFiles">
<set>
<value>resources/js/client.js</value>
<value>resources/js/grant.js</value>
<value>resources/js/scope.js</value>
<value>resources/js/whitelist.js</value>
<value>resources/js/dynreg.js</value>
<value>resources/js/rsreg.js</value>
<value>resources/js/token.js</value>
<value>resources/js/blacklist.js</value>
<value>resources/js/profile.js</value>
<value>resources/js/policy.js</value>
</set>
</property>
<property name="templateFiles">
<set>
</set>
</property>
</bean>
</beans>

File diff suppressed because it is too large Load Diff

View File

@ -646,4 +646,142 @@ var PolicyFormView = Backbone.View.extend({
return this;
}
});
});
ui.routes.push({path: "user/policy", name: "policy", callback:
function() {
this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([
{text:$.t('admin.home'), href:""},
{text:$.t('policy.resource-sets'), href:"manage/#user/policy"}
]);
this.updateSidebar('user/policy');
var view = new ResourceSetListView({model: this.resourceSetList, clientList: this.clientList, systemScopeList: this.systemScopeList});
view.load(function() {
$('#content').html(view.render().el);
setPageTitle($.t('policy.resource-sets'));
});
}
});
ui.routes.push({path: "user/policy/:rsid", name: "editPolicies", callback:
function(rsid) {
this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([
{text:$.t('admin.home'), href:""},
{text:$.t('policy.resource-sets'), href:"manage/#user/policy"},
{text:$.t('policy.edit-policies'), href:"manage/#user/policy/" + rsid}
]);
this.updateSidebar('user/policy');
var rs = this.resourceSetList.get(rsid);
var policies = null;
if (rs == null) {
// need to load it directly
policies = new PolicyCollection([], {rsid: rsid});
rs = new ResourceSetModel({id: rsid});
this.resourceSetList.add(rs); // it will be loaded below, don't need to load it again in the future
} else {
// the resource set is loaded, preload the claims
policies = new PolicyCollection(rs.get('policies'), {rsid: rsid});
policies.isFetched = true;
}
var view = new PolicyListView({model: policies, rs: rs, systemScopeList: this.systemScopeList});
view.load(function() {
$('#content').html(view.render().el);
setPageTitle($.t('policy.edit-policy'));
});
}
});
ui.routes.push({path: "user/policy/:rsid/new", name: "newPolicy", callback:
function(rsid) {
this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([
{text:$.t('admin.home'), href:""},
{text:$.t('policy.resource-sets'), href:"manage/#user/policy"},
{text:$.t('policy.edit-policies'), href:"manage/#user/policy/" + rsid},
{text:$.t('policy.new-policy'), href:"manage/#user/policy/" + rsid + "/new"}
]);
this.updateSidebar('user/policy');
var policy = policy = new PolicyModel({}, {rsid: rsid});
var rs = this.resourceSetList.get(rsid);
if (rs == null) {
// need to load it directly
rs = new ResourceSetModel({id: rsid});
this.resourceSetList.add(rs); // it will be loaded below, don't need to load it again in the future
}
var view = new PolicyFormView({model: policy, rs: rs, systemScopeList: this.systemScopeList});
view.load(function() {
$('#content').html(view.render().el);
setPageTitle($.t('policy.edit-policy'));
});
}
});
ui.routes.push({path: "user/policy/:rsid/:pid", name: "editPolicy", callback:
function(rsid, pid) {
this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([
{text:$.t('admin.home'), href:""},
{text:$.t('policy.resource-sets'), href:"manage/#user/policy"},
{text:$.t('policy.edit-policies'), href:"manage/#user/policy/" + rsid},
{text:$.t('policy.edit-policy'), href:"manage/#user/policy/" + rsid + "/" + pid}
]);
this.updateSidebar('user/policy');
var rs = this.resourceSetList.get(rsid);
var policy = null;
if (rs == null) {
// need to load it directly
policy = new PolicyModel({id: pid}, {rsid: rsid});
rs = new ResourceSetModel({id: rsid});
this.resourceSetList.add(rs); // it will be loaded below, don't need to load it again in the future
} else {
// the resource set is loaded, preload the claims
_.each(rs.get('policies'), function(p) {
if (p.id == pid) {
policy = new PolicyModel(p, {rsid: rsid});
policy.isFetched = true;
}
});
if (policy == null) {
// need to load it directly
policy = new PolicyModel({id: pid}, {rsid: rsid});
}
}
var view = new PolicyFormView({model: policy, rs: rs, systemScopeList: this.systemScopeList});
view.load(function() {
$('#content').html(view.render().el);
setPageTitle($.t('policy.edit-policy'));
});
}
});
ui.templates.push('resources/template/policy.html');
ui.init.push(function(app) {
app.resourceSetList = new ResourceSetCollection();
});