Skip to content

Commit 69ee822

Browse files
committed
Filter available roles in dropdown by config
Adds a feature that reduces the number of available options in the dropdowns in the access policy tab. It does this bx matching prefixes that are defined in the config in the backend. This can for example be used to filter out all roles with "ROLE_GROUP" prefix, to make the dropdowns more usable.
1 parent 47bf603 commit 69ee822

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,16 @@ export const AccessPolicyTable = <T extends AccessPolicyTabFormikProps>({
465465
return newRole;
466466
};
467467

468+
// Filter available options by custom prefixes from the config
469+
if (aclDefaults) {
470+
if (aclDefaults["display_role_filter_prefixes"]) {
471+
const prefixes = aclDefaults["display_role_filter_prefixes"].split(",");
472+
rolesFilteredbyPolicies = rolesFilteredbyPolicies.filter(role =>
473+
!prefixes.some(prefix => role.name.startsWith(prefix)),
474+
);
475+
}
476+
}
477+
468478
return (
469479
<>
470480
{/* list of policy details and interface for changing them */}

0 commit comments

Comments
 (0)