[Security Solution] UI Blocklist RBAC#146455
Conversation
1abd7a3 to
479cd6b
Compare
|
Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt) |
dasansol92
left a comment
There was a problem hiding this comment.
LGTM! Left minor suggestions on test cases but other than that, it looks great!
| expect(filteredLinks).toEqual(getLinksWithout(SecurityPageName.eventFilters)); | ||
| }); | ||
|
|
||
| it('should hide Blocklist for user without privilege', async () => { |
There was a problem hiding this comment.
Should we add a test case for the case it has right privileges and Blocklist is shown?
There was a problem hiding this comment.
There is a test case for showing all links, I believe that should be enough. What was missing is the correct name, so I renamed it: 00e8553
| }); | ||
| }); | ||
|
|
||
| describe('READ privilege', () => { |
There was a problem hiding this comment.
Should we add a NONE privileges case?
There was a problem hiding this comment.
This page is never displayed with NONE privilege - instead the NoPrivileges page is displayed, so I think there is no need for that test case.
paul-tavares
left a comment
There was a problem hiding this comment.
Left some feedback. Let me know your thoughts on my suggestion for the policy names in the card's popover
| {children} | ||
| </EuiButtonEmpty> | ||
| } | ||
| disabled={!canReadPolicies} |
There was a problem hiding this comment.
I don't think its a good idea to display this with a disabled Button. When the user is not allowed to Read policies, then we should just display the policy name using regular text (<EuiText />). It looks strange (to me) for those entries to be displayed grey'ed out in the UI.
Thoughts?
There was a problem hiding this comment.
I agree, so with some more effort, here is a new version: babbcf2
(I've added screenshots to the description)
| history.push(BLOCKLIST_PATH); | ||
| }); | ||
|
|
||
| mockedEndpointPrivileges = { canWriteBlocklist: true }; |
There was a problem hiding this comment.
Can you use getEndpointAuthzInitialStateMock() here to instead of setting this to a partial object? it will be easier to maintain in the future, especially if we start to check other RBAC properties for whatever reason - they will be already set.
| `; | ||
|
|
||
| const StyledEuiText = styled(EuiText)` | ||
| padding: 10px 12px; |
There was a problem hiding this comment.
can you use Eui Style props here instead of hard coding it?
Should be able to use one of the "size" props in the theme - https://gist.github.com/paul-tavares/303d718ac7f514d6ee681a3851407a7e#file-eui_theme_style_props-js-L576-L579
(FYI: that's my own gist that I keep as a reference to what's available in the theme)
There was a problem hiding this comment.
Thanks a lot for this suggestion! Unfortunately, I forgot about using theme constants, so I'm glad it came up.
| }); | ||
|
|
||
| it('should hide Event Filters for user without privilege', async () => { | ||
| it('should hide Blocklist for user without privilege', async () => { |
There was a problem hiding this comment.
Why did you change this test from Event filters to Blocklist?
There was a problem hiding this comment.
It must be some merge/diff magic. 🤷
Originally I had should show and should hide tests for Trusted Apps, but then figured that there's only need for one should show all test, and individual should hide tests for all artefacts. So I renamed the should show Trusted Apps test and moved it up in this commit: 00e8553
Then got some merge conflicts and stuff, so here we are, with a messed up diff, where should show Trusted Apps became should hide Event filters, and should hide Event filters became should hide Blocklists. So I think all should be fine, every test is here.
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Async chunks
Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
Similarly to #145593 and #146111, this PR handles the None and Read privileges for the Blocklist sub-feature. The All privilege should not need any UI modification, but will need API modification.

The modification should:
ArtifactListPage) by disabling the links in the 'Applied for N policies' context menuFor testing the last part:
Readprivilege for Blocklist (or any other artifact usingArtifactListPage), andNoneto PoliciesFleet:AllandIntegrations:ReadprivilegesWith

Policies:Readprivilege, hovering on the last item:With

Policies:Noneprivilege, hovering on the last item:Checklist
Delete any items that are not applicable to this PR.