-
Notifications
You must be signed in to change notification settings - Fork 1k
RANGER-5212: Search filter in Roles tab does not consider all relevant role columns #580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the existing “Role Name” filter so that it also searches values in the sub-role (Associated Role) column.
- Adds a new “Associated Role” text filter to the Roles tab UI
- Registers
subRoleName
andsubRoleNamePartial
in the service search fields and request parameter mapping - Hooks the new filters into the backend predicate logic
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
security-admin/.../RoleListing.jsx | Added new UI filter object for Associated Role |
security-admin/.../RangerRoleServiceBase.java | Registered full and partial sub-role search fields |
security-admin/.../RangerSearchUtil.java | Mapped HTTP parameters for sub-role filters |
agents-common/.../SearchFilter.java | Defined constants for subRoleName filters |
agents-common/.../RolePredicateUtil.java | Added predicate calls for new sub-role filters |
{ | ||
category: "subRoleNamePartial", | ||
label: "Associated Role", | ||
urlLabel: "associatedRoles", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The urlLabel
is set to associatedRoles
but the backend expects the query parameter subRoleNamePartial
. Update it to subRoleNamePartial
so the filter value is sent correctly.
urlLabel: "associatedRoles", | |
urlLabel: "subRoleNamePartial", |
Copilot uses AI. Check for mistakes.
@@ -37,10 +37,12 @@ public void addPredicates(SearchFilter filter, List<Predicate> predicates) { | |||
addPredicateForRoleId(filter.getParam(SearchFilter.ROLE_ID), predicates); | |||
addPredicateForGroupName(filter.getParam(SearchFilter.GROUP_NAME), predicates); | |||
addPredicateForUserName(filter.getParam(SearchFilter.USER_NAME), predicates); | |||
addPredicateForRoleName(filter.getParam(SearchFilter.SUB_ROLE_NAME), predicates); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reuses addPredicateForRoleName
, which filters on the root entity's name
field. You need a predicate targeting the joined subRoleName
field (e.g., add a dedicated addPredicateForSubRoleName
).
addPredicateForRoleName(filter.getParam(SearchFilter.SUB_ROLE_NAME), predicates); | |
addPredicateForSubRoleName(filter.getParam(SearchFilter.SUB_ROLE_NAME), predicates); |
Copilot uses AI. Check for mistakes.
|
||
addPredicateForPartialRoleName(filter.getParam(SearchFilter.ROLE_NAME_PARTIAL), predicates); | ||
addPredicateForPartialGroupName(filter.getParam(SearchFilter.GROUP_NAME_PARTIAL), predicates); | ||
addPredicateForPartialUserName(filter.getParam(SearchFilter.USER_NAME_PARTIAL), predicates); | ||
addPredicateForPartialRoleName(filter.getParam(SearchFilter.SUB_ROLE_NAME_PARTIAL), predicates); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling addPredicateForPartialRoleName
filters the root name
property, not the joined subRoleName
. Introduce a method to apply a partial match on the subRoleName
column instead.
addPredicateForPartialRoleName(filter.getParam(SearchFilter.SUB_ROLE_NAME_PARTIAL), predicates); | |
addPredicateForPartialSubRoleName(filter.getParam(SearchFilter.SUB_ROLE_NAME_PARTIAL), predicates); |
Copilot uses AI. Check for mistakes.
What changes were proposed in this pull request?
When using the Role Name filter, it only matches values from the Role Name column. It does not match values from the Roles column, even though that column contains the role
How was this patch tested?
Tested and Validated search for below API.
/roles/lookup/roles?subRoleName=r2
/roles/lookup/roles?subRoleNamePartial=r2