From 843914877138f06753e0526f218e9e81843306b9 Mon Sep 17 00:00:00 2001 From: Ark2307 Date: Fri, 3 Jan 2025 15:56:12 +0530 Subject: [PATCH 1/2] Seperated basic rbac in ui --- .../apps/dashboard/pages/settings/users/Users.jsx | 2 +- apps/dashboard/web/polaris_web/web/src/util/func.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/settings/users/Users.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/settings/users/Users.jsx index cf65e32dda..898971160e 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/settings/users/Users.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/settings/users/Users.jsx @@ -25,7 +25,7 @@ const Users = () => { const [usersCollection, setUsersCollection] = useState([]) const [roleHierarchy, setRoleHierarchy] = useState([]) const [allCollections, setAllCollections] = useState([]) - let rbacAccess = func.checkForRbacFeature(); + let rbacAccess = func.checkForRbacFeatureBasic(); const collectionsMap = PersistStore(state => state.collectionsMap) diff --git a/apps/dashboard/web/polaris_web/web/src/util/func.js b/apps/dashboard/web/polaris_web/web/src/util/func.js index 652b884201..fbb703d9bb 100644 --- a/apps/dashboard/web/polaris_web/web/src/util/func.js +++ b/apps/dashboard/web/polaris_web/web/src/util/func.js @@ -1646,6 +1646,16 @@ showConfirmationModal(modalContent, primaryActionContent, primaryAction) { } return false; }, + checkForRbacFeatureBasic(){ + const stiggFeatures = window.STIGG_FEATURE_WISE_ALLOWED + let rbacAccess = false; + if (!stiggFeatures || Object.keys(stiggFeatures).length === 0) { + rbacAccess = true + } else if(stiggFeatures && stiggFeatures['RBAC_BASIC']){ + rbacAccess = stiggFeatures['RBAC_BASIC'].isGranted + } + return rbacAccess; + }, checkForRbacFeature(){ const stiggFeatures = window.STIGG_FEATURE_WISE_ALLOWED let rbacAccess = false; @@ -1657,7 +1667,7 @@ showConfirmationModal(modalContent, primaryActionContent, primaryAction) { return rbacAccess; }, checkUserValidForIntegrations(){ - const rbacAccess = this.checkForRbacFeature(); + const rbacAccess = this.checkForRbacFeatureBasic(); if(!rbacAccess){ return true; } From 3e37032029e22a8fe22f8d9021ba0dab7259fa62 Mon Sep 17 00:00:00 2001 From: Ark2307 Date: Fri, 3 Jan 2025 16:01:19 +0530 Subject: [PATCH 2/2] fixing users page --- .../web/src/apps/dashboard/pages/settings/users/Users.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/settings/users/Users.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/settings/users/Users.jsx index 898971160e..adc3d73268 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/settings/users/Users.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/settings/users/Users.jsx @@ -26,6 +26,7 @@ const Users = () => { const [roleHierarchy, setRoleHierarchy] = useState([]) const [allCollections, setAllCollections] = useState([]) let rbacAccess = func.checkForRbacFeatureBasic(); + let rbacAccessAdvanced = func.checkForRbacFeature() const collectionsMap = PersistStore(state => state.collectionsMap) @@ -319,7 +320,7 @@ const Users = () => { { content: ( - { (role === 'ADMIN' || userRole !== 'ADMIN' || !rbacAccess) ? undefined : + { (role === 'ADMIN' || userRole !== 'ADMIN' || !rbacAccessAdvanced) ? undefined :