ac7d03
From 5ccffb9ca109d820c5535140713a5b6672aa4f71 Mon Sep 17 00:00:00 2001
ac7d03
From: Pavel Vomacka <pvomacka@redhat.com>
ac7d03
Date: Fri, 24 Mar 2017 10:19:21 +0100
ac7d03
Subject: [PATCH] WebUI: Fix showing vault in selfservice view
ac7d03
ac7d03
Vaults menu item was shown even when the KRA service was not installed.
ac7d03
That was caused by different path to the menu item in admin's view
ac7d03
and in selfservice view.
ac7d03
ac7d03
The path is now set correctly for both situations. 'network_service/vault'
ac7d03
for admin's view and 'vault' for selfservice view.
ac7d03
ac7d03
https://pagure.io/freeipa/issue/6812
ac7d03
ac7d03
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
ac7d03
---
ac7d03
 install/ui/src/freeipa/navigation/menu_spec.js | 1 +
ac7d03
 install/ui/src/freeipa/vault.js                | 8 +++++---
ac7d03
 2 files changed, 6 insertions(+), 3 deletions(-)
ac7d03
ac7d03
diff --git a/install/ui/src/freeipa/navigation/menu_spec.js b/install/ui/src/freeipa/navigation/menu_spec.js
ac7d03
index 9329694c14a47cbe1ec244554327b40743044d7b..0c30459691d8f652dc35ccf74ed27fae7654020d 100644
ac7d03
--- a/install/ui/src/freeipa/navigation/menu_spec.js
ac7d03
+++ b/install/ui/src/freeipa/navigation/menu_spec.js
ac7d03
@@ -326,6 +326,7 @@ nav.self_service = {
ac7d03
         { entity: 'user' },
ac7d03
         { entity: 'otptoken' },
ac7d03
         {
ac7d03
+            name: 'vault',
ac7d03
             entity: 'vault',
ac7d03
             facet: 'search',
ac7d03
             children: [
ac7d03
diff --git a/install/ui/src/freeipa/vault.js b/install/ui/src/freeipa/vault.js
ac7d03
index b5cdc810adea9b521df77eb328b55475a707580a..36a4838ee108020cf6ad7a20c59e4ab5403f3528 100644
ac7d03
--- a/install/ui/src/freeipa/vault.js
ac7d03
+++ b/install/ui/src/freeipa/vault.js
ac7d03
@@ -809,9 +809,11 @@ vault.config_sidebar_policy = function(spec) {
ac7d03
 
ac7d03
 
ac7d03
 vault.remove_vault_menu_item = function() {
ac7d03
-    if (!IPA.vault_enabled) {
ac7d03
-        menu.remove_item('network_services/vault');
ac7d03
-    }
ac7d03
+    if (IPA.vault_enabled) return;
ac7d03
+
ac7d03
+    var menu_location = IPA.is_selfservice ? 'vault' : 'network_services/vault';
ac7d03
+
ac7d03
+    menu.remove_item(menu_location);
ac7d03
 };
ac7d03
 
ac7d03
 vault.my_vault_spec = make_my_vault_spec();
ac7d03
-- 
ac7d03
2.12.1
ac7d03