Admin: project and user management hide/show based on role
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 12 Apr 2017 19:23:16 +0000 (15:23 -0400)
committerLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 12 Apr 2017 19:23:16 +0000 (15:23 -0400)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/framework/widgets/skyquake_nav/skyquakeNav.jsx
skyquake/plugins/project_management/config.json

index c4df1e2..f9161cc 100644 (file)
@@ -309,6 +309,7 @@ export function buildNav(nav, currentPlugin, props) {
                 label: nav[k].label || k,
                 route: route
             });
+            let shouldAllow = nav[k].allow || ['*'];
             if (nav[k].pluginName == currentPlugin) {
                 navClass += " active";
             }
@@ -316,13 +317,15 @@ export function buildNav(nav, currentPlugin, props) {
             navItem.priority = nav[k].priority;
             navItem.order = nav[k].order;
             if(nav[k].admin_link) {
-                adminNav.push((
-                    <li key={nav[k].name}>
-                        {dashboardLink}
-                    </li>
-                ))
+
+                if (isRBACValid(User, shouldAllow) ){
+                    adminNav.push((
+                        <li key={nav[k].name}>
+                            {dashboardLink}
+                        </li>
+                    ))
+                }
             } else {
-                let shouldAllow = nav[k].allow || ['*'];
                 if (isRBACValid(User, shouldAllow) ){
                     navItem.html = (
                         <div  key={k} className={navClass}>
index 642fb90..34537c6 100644 (file)
@@ -5,6 +5,7 @@
     "order": 1,
     "priority":2,
     "admin_link": true,
+    "allow": ["rw-rbac-platform:super-admin", "rw-rbac-platform:platform-admin", "rw-rbac-platform:platform-oper", "rw-project:project-admin", "rw-project:project-oper"],
     "routes": [
     {
         "label": "Project Management Dashboard",