summaryrefslogtreecommitdiffstats
path: root/base/tps/shared
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2016-10-20 00:54:47 +0200
committerEndi S. Dewata <edewata@redhat.com>2016-10-21 17:17:57 +0200
commitf979c3b436e9a12e8c71ba0abab5c892d375f945 (patch)
tree4b2698b5eae632e6469611033e12971de6bf5edf /base/tps/shared
parent3e05e67da87c5ce4742c77b43f2a122a968e4cc9 (diff)
downloadpki-f979c3b436e9a12e8c71ba0abab5c892d375f945.tar.gz
pki-f979c3b436e9a12e8c71ba0abab5c892d375f945.tar.xz
pki-f979c3b436e9a12e8c71ba0abab5c892d375f945.zip
Fixed TPS UI system menu.
The TPS UI has been modified to adjust the system menu based on the list of accessible components obtained during login. The TPSApplication has been modified to use TPSAccountService which returns the list of accessible components based on the following properties in the CS.cfg: * admin: target.configure.list * agent: target.agent_approve.list The AccountInfo has been changed to extend the ResourceMessage such that it can be used to pass the list of accessible components as an attribute. https://fedorahosted.org/pki/ticket/2523
Diffstat (limited to 'base/tps/shared')
-rw-r--r--base/tps/shared/webapps/tps/ui/index.html56
1 files changed, 50 insertions, 6 deletions
diff --git a/base/tps/shared/webapps/tps/ui/index.html b/base/tps/shared/webapps/tps/ui/index.html
index 63baf3e27..93d3af0b0 100644
--- a/base/tps/shared/webapps/tps/ui/index.html
+++ b/base/tps/shared/webapps/tps/ui/index.html
@@ -46,6 +46,40 @@
<script>
$(function() {
+ function getAttribute(attributes, name) {
+ for (var i=0; i<attributes.length; i++) {
+ var attribute = attributes[i];
+ if (name != attribute.name) continue;
+ return attribute.value;
+ }
+ return null;
+ }
+
+ function getElementName(component) {
+
+ if (component == "Generals") {
+ return "config";
+
+ } else if (component == "Authentication_Sources") {
+ return "authenticators";
+
+ } else if (component == "Subsystem_Connections") {
+ return "connectors";
+
+ } else if (component == "Profiles") {
+ return "profiles";
+
+ } else if (component == "Profile_Mappings") {
+ return "profile-mappings";
+
+ } else if (component == "Audit_Logging") {
+ return "audit";
+
+ } else {
+ return null;
+ }
+ }
+
var account = new Account();
account.login({
success: function(data, textStatus, jqXHR) {
@@ -64,14 +98,24 @@ $(function() {
accounts_menu.hide();
}
- if (_.contains(roles, "Administrators")) {
- system_menu.show();
- $("li", system_menu).show();
+ var attributes = tps.user.Attributes.Attribute;
+ var values = getAttribute(attributes, "components");
+
+ var components;
+ if (values) {
+ components = values.split(",");
+ } else {
+ components = [];
+ }
- } else if (_.contains(roles, "TPS Agents")) {
+ if (components.length > 0) {
+ // display menu items for accessible components
system_menu.show();
- $("li", system_menu).hide();
- $("[name=profiles]", system_menu).show();
+ for (var i=0; i<components.length; i++) {
+ var name = getElementName(components[i]);
+ if (!name) continue;
+ $("[name=" + name + "]", system_menu).show();
+ }
} else {
system_menu.hide();