[v14] Correctly filter out system roles#40762
Conversation
* Correctly filter out system roles * Move `SkipSystemRoles` check above `SearchKeywords` check * Add tests (cherry picked from commit 22a3389)
| // Match checks if the given role matches this filter. | ||
| func (f *RoleFilter) Match(role *RoleV6) bool { | ||
| if f.SkipSystemRoles { | ||
| return !IsSystemResource(role) |
There was a problem hiding this comment.
Hi there @gzdunek, I think this line might have introduced a bug (at least on v14.3.16).
Right now if you search for roles in the web UI (at least within the Edit User modal), it will never reach the search keywords part below, thus search will never return filtered results by keyword.
We found this regression on one of our production instances while trying to add a new role to a user, search is always returning the same list regardless of the keyword. We have some hundreds of roles so keyword search is very useful to us. Meanwhile we've resorted to the CLI for now to manage user roles.
I was also looking at #40464 if the bug is related to the new pagination, but this line caught my eye because of the early return.
cc #40545
There was a problem hiding this comment.
That's an obvious bug 🤦
I shouldn't have changed the checks order.
Sorry about that, I will send a PR with a fix soon.
Thanks for reaching out.
Backport #40545 to branch/v15.
Manual backport due to conflicts in
types.pb.go.