summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/server/share/webapps/pki/css/pki-ui.css5
-rw-r--r--base/server/share/webapps/pki/js/pki-ui.js20
-rw-r--r--base/tps/shared/webapps/tps/js/audit.js4
-rw-r--r--base/tps/shared/webapps/tps/js/token.js4
-rw-r--r--base/tps/shared/webapps/tps/js/tps.js24
-rw-r--r--base/tps/shared/webapps/tps/ui/audit.html4
-rw-r--r--base/tps/shared/webapps/tps/ui/authenticator.html4
-rw-r--r--base/tps/shared/webapps/tps/ui/config.html4
-rw-r--r--base/tps/shared/webapps/tps/ui/connector.html4
-rw-r--r--base/tps/shared/webapps/tps/ui/group.html4
-rw-r--r--base/tps/shared/webapps/tps/ui/home.html34
-rw-r--r--base/tps/shared/webapps/tps/ui/index.html39
-rw-r--r--base/tps/shared/webapps/tps/ui/profile-mapping.html4
-rw-r--r--base/tps/shared/webapps/tps/ui/profile.html4
-rw-r--r--base/tps/shared/webapps/tps/ui/token.html4
-rw-r--r--base/tps/shared/webapps/tps/ui/user.html4
16 files changed, 108 insertions, 58 deletions
diff --git a/base/server/share/webapps/pki/css/pki-ui.css b/base/server/share/webapps/pki/css/pki-ui.css
index c02028876..0d5edd7fd 100644
--- a/base/server/share/webapps/pki/css/pki-ui.css
+++ b/base/server/share/webapps/pki/css/pki-ui.css
@@ -41,6 +41,11 @@
display: inline-block;
}
+.pki-menu {
+ padding: 0;
+ list-style-type: none;
+}
+
.pki-actions {
float: right;
display: inline-block;
diff --git a/base/server/share/webapps/pki/js/pki-ui.js b/base/server/share/webapps/pki/js/pki-ui.js
index 7d8e6eef6..98e3330c0 100644
--- a/base/server/share/webapps/pki/js/pki-ui.js
+++ b/base/server/share/webapps/pki/js/pki-ui.js
@@ -925,12 +925,14 @@ var EntryPage = Page.extend({
setup: function() {
var self = this;
- self.menu = self.$(".pki-menu");
- self.editLink = $("a[name='edit']", self.menu);
+ self.actions = self.$(".pki-actions");
- self.buttons = self.$(".pki-buttons");
- self.cancelButton = $("button[name='cancel']", self.buttons);
- self.saveButton = $("button[name='save']", self.buttons);
+ self.viewMenu = $(".pki-actions-menu[name='view']", self.actions);
+ self.editLink = $("a[name='edit']", self.viewMenu);
+
+ self.editMenu = $(".pki-actions-menu[name='edit']", self.actions);
+ self.cancelButton = $("button[name='cancel']", self.editMenu);
+ self.saveButton = $("button[name='save']", self.editMenu);
self.idField = self.$("input[name='id']");
self.statusField = self.$("input[name='status']");
@@ -996,11 +998,10 @@ var EntryPage = Page.extend({
input.attr("readonly", "readonly");
});
- self.buttons.hide();
- self.menu.show();
+ self.viewMenu.show();
+ self.editMenu.hide();
} else {
- self.menu.hide();
// Show editable fields.
self.$(".pki-fields input").each(function(index) {
@@ -1013,7 +1014,8 @@ var EntryPage = Page.extend({
}
});
- self.buttons.show();
+ self.viewMenu.hide();
+ self.editMenu.show();
}
self.$(".pki-fields input").each(function(index) {
diff --git a/base/tps/shared/webapps/tps/js/audit.js b/base/tps/shared/webapps/tps/js/audit.js
index 986596e1d..62e6b099e 100644
--- a/base/tps/shared/webapps/tps/js/audit.js
+++ b/base/tps/shared/webapps/tps/js/audit.js
@@ -142,8 +142,8 @@ var AuditPage = EntryPage.extend({
AuditPage.__super__.setup.call(self);
- self.enableLink = $("a[name='enable']", self.menu);
- self.disableLink = $("a[name='disable']", self.menu);
+ self.enableLink = $("a[name='enable']", self.viewMenu);
+ self.disableLink = $("a[name='disable']", self.viewMenu);
self.enableLink.click(function(e) {
diff --git a/base/tps/shared/webapps/tps/js/token.js b/base/tps/shared/webapps/tps/js/token.js
index c1f27b132..4cc3b5bcf 100644
--- a/base/tps/shared/webapps/tps/js/token.js
+++ b/base/tps/shared/webapps/tps/js/token.js
@@ -110,7 +110,7 @@ var TokenPage = EntryPage.extend({
TokenPage.__super__.setup.call(self);
- self.changeStatusLink = $("a[name='changeStatus']", self.menu);
+ self.changeStatusLink = $("a[name='changeStatus']", self.viewMenu);
self.changeStatusLink.click(function(e) {
@@ -154,7 +154,7 @@ var TokenPage = EntryPage.extend({
dialog.open();
});
- self.showCertsLink = $("a[name='showCerts']", self.menu);
+ self.showCertsLink = $("a[name='showCerts']", self.viewMenu);
self.showCertsLink.click(function(e) {
diff --git a/base/tps/shared/webapps/tps/js/tps.js b/base/tps/shared/webapps/tps/js/tps.js
index 476533759..85d1751eb 100644
--- a/base/tps/shared/webapps/tps/js/tps.js
+++ b/base/tps/shared/webapps/tps/js/tps.js
@@ -19,6 +19,8 @@
* @author Endi S. Dewata
*/
+var tps = {};
+
var PropertiesTableItem = TableItem.extend({
initialize: function(options) {
var self = this;
@@ -114,6 +116,24 @@ var PropertiesTable = Table.extend({
}
});
+var HomePage = Page.extend({
+ load: function() {
+ var roles = tps.user.Roles.Role;
+ var home_accounts = self.$("[name=home-accounts]");
+ var home_system = self.$("[name=home-system]");
+
+ if (_.contains(roles, "Administrators")) {
+ home_accounts.show();
+ $("li", home_system).show();
+
+ } else if (_.contains(roles, "TPS Agents")) {
+ home_accounts.hide();
+ $("li", home_system).hide();
+ $("[name=profiles]", home_system).show();
+ }
+ }
+});
+
var ConfigEntryPage = EntryPage.extend({
initialize: function(options) {
var self = this;
@@ -126,8 +146,8 @@ var ConfigEntryPage = EntryPage.extend({
ConfigEntryPage.__super__.setup.call(self);
- self.enableLink = $("a[name='enable']", self.menu);
- self.disableLink = $("a[name='disable']", self.menu);
+ self.enableLink = $("a[name='enable']", self.viewMenu);
+ self.disableLink = $("a[name='disable']", self.viewMenu);
self.enableLink.click(function(e) {
diff --git a/base/tps/shared/webapps/tps/ui/audit.html b/base/tps/shared/webapps/tps/ui/audit.html
index 3e6cc6cbb..f9da85196 100644
--- a/base/tps/shared/webapps/tps/ui/audit.html
+++ b/base/tps/shared/webapps/tps/ui/audit.html
@@ -25,12 +25,12 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
<a name="enable" href="#">Enable</a><a name="disable" href="#" style="display: none;">Disable</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>
diff --git a/base/tps/shared/webapps/tps/ui/authenticator.html b/base/tps/shared/webapps/tps/ui/authenticator.html
index 6da1fbf12..cde9e65c4 100644
--- a/base/tps/shared/webapps/tps/ui/authenticator.html
+++ b/base/tps/shared/webapps/tps/ui/authenticator.html
@@ -26,12 +26,12 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
<a name="enable" href="#">Enable</a><a name="disable" href="#" style="display: none;">Disable</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>
diff --git a/base/tps/shared/webapps/tps/ui/config.html b/base/tps/shared/webapps/tps/ui/config.html
index d94a0fa28..2a8e85902 100644
--- a/base/tps/shared/webapps/tps/ui/config.html
+++ b/base/tps/shared/webapps/tps/ui/config.html
@@ -25,11 +25,11 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>
diff --git a/base/tps/shared/webapps/tps/ui/connector.html b/base/tps/shared/webapps/tps/ui/connector.html
index 015a7ac6d..782c6d245 100644
--- a/base/tps/shared/webapps/tps/ui/connector.html
+++ b/base/tps/shared/webapps/tps/ui/connector.html
@@ -26,12 +26,12 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
<a name="enable" href="#">Enable</a><a name="disable" href="#" style="display: none;">Disable</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>
diff --git a/base/tps/shared/webapps/tps/ui/group.html b/base/tps/shared/webapps/tps/ui/group.html
index 493b79488..11c9944b2 100644
--- a/base/tps/shared/webapps/tps/ui/group.html
+++ b/base/tps/shared/webapps/tps/ui/group.html
@@ -26,11 +26,11 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>
diff --git a/base/tps/shared/webapps/tps/ui/home.html b/base/tps/shared/webapps/tps/ui/home.html
index f21040fdb..08c467255 100644
--- a/base/tps/shared/webapps/tps/ui/home.html
+++ b/base/tps/shared/webapps/tps/ui/home.html
@@ -28,33 +28,39 @@
<h3 class="panel-title">Token Management</h3>
</div>
<div class="panel-body">
- <a href="#tokens">Tokens</a><br>
- <a href="#certs">Certificates</a><br>
- <a href="#activities">Activities</a><br>
+ <ul class="pki-menu">
+ <li><a href="#tokens">Tokens</a></li>
+ <li><a href="#certs">Certificates</a></li>
+ <li><a href="#activities">Activities</a></li>
+ </ul>
</div>
</div>
-<div class="panel panel-default">
+<div name="home-accounts" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Account Management</h3>
</div>
<div class="panel-body">
- <a href="#users">Users</a><br>
- <a href="#groups">Groups</a><br>
+ <ul class="pki-menu">
+ <li><a href="#users">Users</a></li>
+ </li><a href="#groups">Groups</a></li>
+ </ul>
</div>
</div>
-<div class="panel panel-default">
+<div name="home-system" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">System Management</h3>
</div>
<div class="panel-body">
- <a href="#config">General Configuration</a><br>
- <a href="#authenticators">Authentication Sources</a><br>
- <a href="#connectors">Subsystem Connections</a><br>
- <a href="#profiles">Profiles</a><br>
- <a href="#profile-mappings">Profile Mappings</a><br>
- <a href="#audit">Audit Logging</a><br>
- <a href="#selftests">Self Tests</a><br>
+ <ul class="pki-menu">
+ <li name="config" style="display: none;"><a href="#config">General Configuration</a></li>
+ <li name="authenticators" style="display: none;"><a href="#authenticators">Authentication Sources</a></li>
+ <li name="connectors" style="display: none;"><a href="#connectors">Subsystem Connections</a></li>
+ <li name="profiles" style="display: none;"><a href="#profiles">Profiles</a></li>
+ <li name="profile-mappings" style="display: none;"><a href="#profile-mappings">Profile Mappings</a></li>
+ <li name="audit" style="display: none;"><a href="#audit">Audit Logging</a></li>
+ <li name="selftests" style="display: none;"><a href="#selftests">Self Tests</a></li>
+ </ul>
</div>
</div>
diff --git a/base/tps/shared/webapps/tps/ui/index.html b/base/tps/shared/webapps/tps/ui/index.html
index 74adeadd1..3bda3cb40 100644
--- a/base/tps/shared/webapps/tps/ui/index.html
+++ b/base/tps/shared/webapps/tps/ui/index.html
@@ -47,10 +47,26 @@ $(function() {
var account = new Account();
account.login({
success: function(data, textStatus, jqXHR) {
+ tps.user = data;
+ var roles = tps.user.Roles.Role;
+
var user = $("#user");
user.text(data.FullName);
+
+ var accounts_menu = $("#navigation [name=accounts]");
+ var system_menu = $("#navigation [name=system]");
+
+ if (_.contains(roles, "Administrators")) {
+ accounts_menu.show();
+ $("li", system_menu).show();
+
+ } else if (_.contains(roles, "TPS Agents")) {
+ accounts_menu.hide();
+ $("li", system_menu).hide();
+ $("[name=profiles]", system_menu).show();
+ }
},
- error: function() {
+ error: function(jqXHR, textStatus, errorThrown) {
window.location.href = "/tps";
}
});
@@ -60,7 +76,7 @@ $(function() {
var router = new Backbone.Router();
router.route("", "home", function() {
- new Page({
+ new HomePage({
el: content,
url: "home.html"
}).open();
@@ -330,6 +346,7 @@ $(function() {
// destroy server session
account.logout({
success: function() {
+ tps.user = null;
// clear browser cache
PKI.logout({
success: function() {
@@ -382,7 +399,7 @@ $(function() {
<li><a href="#tokens">Tokens</a></li>
<li><a href="#certs">Certificates</a></li>
<li><a href="#activities">Activities</a></li>
- <li class="dropdown context">
+ <li name="accounts" class="dropdown context" style="display: none;">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Accounts
<b class="caret"></b>
@@ -392,19 +409,19 @@ $(function() {
<li><a href="#groups">Groups</a></li>
</ul>
</li>
- <li class="dropdown context">
+ <li name="system" class="dropdown context">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
System
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
- <li><a href="#config">General Configuration</a></li>
- <li><a href="#authenticators">Authentication Sources</a></li>
- <li><a href="#connectors">Subsystem Connections</a></li>
- <li><a href="#profiles">Profiles</a></li>
- <li><a href="#profile-mappings">Profile Mappings</a></li>
- <li><a href="#audit">Audit Logging</a></li>
- <li><a href="#selftests">Self Tests</a></li>
+ <li name="config" style="display: none;"><a href="#config">General Configuration</a></li>
+ <li name="authenticators" style="display: none;"><a href="#authenticators">Authentication Sources</a></li>
+ <li name="connectors" style="display: none;"><a href="#connectors">Subsystem Connections</a></li>
+ <li name="profiles" style="display: none;"><a href="#profiles">Profiles</a></li>
+ <li name="profile-mappings" style="display: none;"><a href="#profile-mappings">Profile Mappings</a></li>
+ <li name="audit" style="display: none;"><a href="#audit">Audit Logging</a></li>
+ <li name="selftests" style="display: none;"><a href="#selftests">Self Tests</a></li>
</ul>
</li>
</ul>
diff --git a/base/tps/shared/webapps/tps/ui/profile-mapping.html b/base/tps/shared/webapps/tps/ui/profile-mapping.html
index 139d21262..fea71ce9d 100644
--- a/base/tps/shared/webapps/tps/ui/profile-mapping.html
+++ b/base/tps/shared/webapps/tps/ui/profile-mapping.html
@@ -26,12 +26,12 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
<a name="enable" href="#">Enable</a><a name="disable" href="#" style="display: none;">Disable</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>
diff --git a/base/tps/shared/webapps/tps/ui/profile.html b/base/tps/shared/webapps/tps/ui/profile.html
index 61811bcc3..1720d4850 100644
--- a/base/tps/shared/webapps/tps/ui/profile.html
+++ b/base/tps/shared/webapps/tps/ui/profile.html
@@ -26,12 +26,12 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
<a name="enable" href="#">Enable</a><a name="disable" href="#" style="display: none;">Disable</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>
diff --git a/base/tps/shared/webapps/tps/ui/token.html b/base/tps/shared/webapps/tps/ui/token.html
index 8be08f09a..39d54c6cd 100644
--- a/base/tps/shared/webapps/tps/ui/token.html
+++ b/base/tps/shared/webapps/tps/ui/token.html
@@ -26,13 +26,13 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
<a name="changeStatus" href="#">Change Status</a><br>
<a name="showCerts" href="#">Show Certificates</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>
diff --git a/base/tps/shared/webapps/tps/ui/user.html b/base/tps/shared/webapps/tps/ui/user.html
index 8463d0bef..9d6b0597a 100644
--- a/base/tps/shared/webapps/tps/ui/user.html
+++ b/base/tps/shared/webapps/tps/ui/user.html
@@ -26,11 +26,11 @@
<span class="pki-actions">
-<span class="pki-menu" style="display: none;">
+<span name="view" class="pki-actions-menu">
<a name="edit" href="#">Edit</a><br>
</span>
-<span class="pki-buttons" style="display: none;">
+<span name="edit" class="pki-actions-menu" style="display: none;">
<button name="cancel">Cancel</button>
<button name="save" class="primary">Save</button>
</span>