summaryrefslogtreecommitdiffstats
path: root/base/tps/shared/webapps/tps/ui
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2015-04-10 04:44:30 -0400
committerEndi S. Dewata <edewata@redhat.com>2015-04-17 13:29:22 -0400
commit5c50472a1d91390879a24df7fcfa60d741f1c011 (patch)
tree9635ebb7ed5e4308cde501c1812e0595854adbe9 /base/tps/shared/webapps/tps/ui
parentf1f11cd1b2b4dfa0a99cbd47953af0fce4e7ec6c (diff)
downloadpki-5c50472a1d91390879a24df7fcfa60d741f1c011.tar.gz
pki-5c50472a1d91390879a24df7fcfa60d741f1c011.tar.xz
pki-5c50472a1d91390879a24df7fcfa60d741f1c011.zip
Customized TPS UI menu based on user roles.
The TPS UI has been modified to customize the navigation menu based on the roles of the user currently logged in. TPS agents do not have access to users, groups, config, authenticators, connectors, profile mappings, audit, and self tests, so the corresponding menu items will be hidden. TPS admins have access to all menu items. https://fedorahosted.org/pki/ticket/1292
Diffstat (limited to 'base/tps/shared/webapps/tps/ui')
-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
11 files changed, 66 insertions, 43 deletions
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>