diff options
author | Endi S. Dewata <edewata@redhat.com> | 2015-04-10 04:44:30 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2015-04-17 13:29:22 -0400 |
commit | 5c50472a1d91390879a24df7fcfa60d741f1c011 (patch) | |
tree | 9635ebb7ed5e4308cde501c1812e0595854adbe9 /base/tps/shared/webapps/tps/ui/index.html | |
parent | f1f11cd1b2b4dfa0a99cbd47953af0fce4e7ec6c (diff) | |
download | pki-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/index.html')
-rw-r--r-- | base/tps/shared/webapps/tps/ui/index.html | 39 |
1 files changed, 28 insertions, 11 deletions
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> |