Skip to content

Commit

Permalink
Merge pull request #1904 from akto-api-security/hotfix/fix_rbac_featu…
Browse files Browse the repository at this point in the history
…re_access

Seperated basic rbac in ui
  • Loading branch information
Ark2307 authored Jan 3, 2025
2 parents fc2956d + 3e37032 commit bcde158
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const Users = () => {
const [usersCollection, setUsersCollection] = useState([])
const [roleHierarchy, setRoleHierarchy] = useState([])
const [allCollections, setAllCollections] = useState([])
let rbacAccess = func.checkForRbacFeature();
let rbacAccess = func.checkForRbacFeatureBasic();
let rbacAccessAdvanced = func.checkForRbacFeature()

const collectionsMap = PersistStore(state => state.collectionsMap)

Expand Down Expand Up @@ -319,7 +320,7 @@ const Users = () => {
{
content: (
<HorizontalStack gap={4}>
{ (role === 'ADMIN' || userRole !== 'ADMIN' || !rbacAccess) ? undefined :
{ (role === 'ADMIN' || userRole !== 'ADMIN' || !rbacAccessAdvanced) ? undefined :
<ResourceListModal
title={"Collection list"}
activatorPlaceaholder={`${(usersCollection[id] || []).length} collections accessible`}
Expand Down
12 changes: 11 additions & 1 deletion apps/dashboard/web/polaris_web/web/src/util/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -1657,7 +1667,7 @@ showConfirmationModal(modalContent, primaryActionContent, primaryAction) {
return rbacAccess;
},
checkUserValidForIntegrations(){
const rbacAccess = this.checkForRbacFeature();
const rbacAccess = this.checkForRbacFeatureBasic();
if(!rbacAccess){
return true;
}
Expand Down

0 comments on commit bcde158

Please sign in to comment.