Skip to content
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

[Security Solution][Notes] - disable add note button in flyout is user lacks privileges #201707

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

PhilippeOberti
Copy link
Contributor

@PhilippeOberti PhilippeOberti commented Nov 26, 2024

Summary

This PR fixes a small issue where users could click on the add button in the alert details flyout even if they did not have the correct privileges.

When the user has the correct privileges, the UI does not change. In the flyout:

  • if no notes have previously been created for the document, we show a Add note button
  • if some notes have previously been created for the document, we show the number of notes and a plus button icon
Screen.Recording.2024-11-25.at.6.16.57.PM.mov

When the user does not have the correct privileges, the flyout UI now shows the following:

  • if no notes have previously been created for the document, we show a -
  • if one or more notes have been created for the document, we show the number of notes followed by a View note(s) button, that - when clicked - opens the left panel for the user to view the notes
Screen.Recording.2024-11-25.at.6.18.00.PM.mov

#201702

Checklist

@PhilippeOberti PhilippeOberti added release_note:fix v9.0.0 Team:Threat Hunting:Investigations Security Solution Investigations Team backport:version Backport to applied version labels v8.17.0 labels Nov 26, 2024
@PhilippeOberti PhilippeOberti requested a review from a team as a code owner November 26, 2024 00:29
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 13.4MB 13.4MB +1.4KB

>
{ADD_NOTE_BUTTON}
</EuiButtonEmpty>
<>{kibanaSecuritySolutionsPrivileges.crud ? addNoteButton : getEmptyTagValue()}</>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 Consider pulling this into its own variable to make it more readable:

const canAddNotes = kibanaSecuritySolutionsPrivileges.crud;
(...)
canAddNotes ? addNoteButton : emptyTag()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this one I actually personally think not extracting is more readable. I can right away see the condition instead of having to navigate to another place in the code...

@PhilippeOberti PhilippeOberti merged commit c7b5b35 into elastic:main Nov 26, 2024
54 checks passed
@PhilippeOberti PhilippeOberti deleted the add-note-user-privilege branch November 26, 2024 14:36
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.17

https://github.com/elastic/kibana/actions/runs/12032872774

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 26, 2024
…r lacks privileges (elastic#201707)

## Summary

This PR fixes a small issue where users could click on the add button in
the alert details flyout even if they did not have the correct
privileges.

When the user has the correct privileges, the UI does not change. In the
flyout:
- if no notes have previously been created for the document, we show a
`Add note` button
- if some notes have previously been created for the document, we show
the number of notes and a plus button icon

https://github.com/user-attachments/assets/d9a27b70-99b1-4562-8224-4f5c2f25b001

When the user does not have the correct privileges, the flyout UI now
shows the following:
- if no notes have previously been created for the document, we show a
`-`
- if one or more notes have been created for the document, we show the
number of notes followed by a `View note(s)` button, that - when clicked
- opens the left panel for the user to view the notes

https://github.com/user-attachments/assets/8ebe8bf5-16ab-4652-b4d3-47507c2d3673

elastic#201702

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit c7b5b35)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.17

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kdelemme pushed a commit to kdelemme/kibana that referenced this pull request Nov 26, 2024
…r lacks privileges (elastic#201707)

## Summary

This PR fixes a small issue where users could click on the add button in
the alert details flyout even if they did not have the correct
privileges.

When the user has the correct privileges, the UI does not change. In the
flyout:
- if no notes have previously been created for the document, we show a
`Add note` button
- if some notes have previously been created for the document, we show
the number of notes and a plus button icon

https://github.com/user-attachments/assets/d9a27b70-99b1-4562-8224-4f5c2f25b001

When the user does not have the correct privileges, the flyout UI now
shows the following:
- if no notes have previously been created for the document, we show a
`-`
- if one or more notes have been created for the document, we show the
number of notes followed by a `View note(s)` button, that - when clicked
- opens the left panel for the user to view the notes

https://github.com/user-attachments/assets/8ebe8bf5-16ab-4652-b4d3-47507c2d3673

elastic#201702

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
kibanamachine added a commit that referenced this pull request Nov 26, 2024
… is user lacks privileges (#201707) (#201802)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[Security Solution][Notes] - disable add note button in flyout is
user lacks privileges
(#201707)](#201707)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Philippe
Oberti","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-26T14:36:47Z","message":"[Security
Solution][Notes] - disable add note button in flyout is user lacks
privileges (#201707)\n\n## Summary\r\n\r\nThis PR fixes a small issue
where users could click on the add button in\r\nthe alert details flyout
even if they did not have the correct\r\nprivileges.\r\n\r\nWhen the
user has the correct privileges, the UI does not change. In
the\r\nflyout:\r\n- if no notes have previously been created for the
document, we show a\r\n`Add note` button\r\n- if some notes have
previously been created for the document, we show\r\nthe number of notes
and a plus button
icon\r\n\r\n\r\nhttps://github.com/user-attachments/assets/d9a27b70-99b1-4562-8224-4f5c2f25b001\r\n\r\nWhen
the user does not have the correct privileges, the flyout UI
now\r\nshows the following:\r\n- if no notes have previously been
created for the document, we show a\r\n`-`\r\n- if one or more notes
have been created for the document, we show the\r\nnumber of notes
followed by a `View note(s)` button, that - when clicked\r\n- opens the
left panel for the user to view the
notes\r\n\r\n\r\nhttps://github.com/user-attachments/assets/8ebe8bf5-16ab-4652-b4d3-47507c2d3673\r\n\r\nhttps://github.com//issues/201702\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"c7b5b35b199611741993e124811352472e8323f2","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Team:Threat
Hunting:Investigations","backport:version","v8.17.0"],"title":"[Security
Solution][Notes] - disable add note button in flyout is user lacks
privileges","number":201707,"url":"https://github.com/elastic/kibana/pull/201707","mergeCommit":{"message":"[Security
Solution][Notes] - disable add note button in flyout is user lacks
privileges (#201707)\n\n## Summary\r\n\r\nThis PR fixes a small issue
where users could click on the add button in\r\nthe alert details flyout
even if they did not have the correct\r\nprivileges.\r\n\r\nWhen the
user has the correct privileges, the UI does not change. In
the\r\nflyout:\r\n- if no notes have previously been created for the
document, we show a\r\n`Add note` button\r\n- if some notes have
previously been created for the document, we show\r\nthe number of notes
and a plus button
icon\r\n\r\n\r\nhttps://github.com/user-attachments/assets/d9a27b70-99b1-4562-8224-4f5c2f25b001\r\n\r\nWhen
the user does not have the correct privileges, the flyout UI
now\r\nshows the following:\r\n- if no notes have previously been
created for the document, we show a\r\n`-`\r\n- if one or more notes
have been created for the document, we show the\r\nnumber of notes
followed by a `View note(s)` button, that - when clicked\r\n- opens the
left panel for the user to view the
notes\r\n\r\n\r\nhttps://github.com/user-attachments/assets/8ebe8bf5-16ab-4652-b4d3-47507c2d3673\r\n\r\nhttps://github.com//issues/201702\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"c7b5b35b199611741993e124811352472e8323f2"}},"sourceBranch":"main","suggestedTargetBranches":["8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201707","number":201707,"mergeCommit":{"message":"[Security
Solution][Notes] - disable add note button in flyout is user lacks
privileges (#201707)\n\n## Summary\r\n\r\nThis PR fixes a small issue
where users could click on the add button in\r\nthe alert details flyout
even if they did not have the correct\r\nprivileges.\r\n\r\nWhen the
user has the correct privileges, the UI does not change. In
the\r\nflyout:\r\n- if no notes have previously been created for the
document, we show a\r\n`Add note` button\r\n- if some notes have
previously been created for the document, we show\r\nthe number of notes
and a plus button
icon\r\n\r\n\r\nhttps://github.com/user-attachments/assets/d9a27b70-99b1-4562-8224-4f5c2f25b001\r\n\r\nWhen
the user does not have the correct privileges, the flyout UI
now\r\nshows the following:\r\n- if no notes have previously been
created for the document, we show a\r\n`-`\r\n- if one or more notes
have been created for the document, we show the\r\nnumber of notes
followed by a `View note(s)` button, that - when clicked\r\n- opens the
left panel for the user to view the
notes\r\n\r\n\r\nhttps://github.com/user-attachments/assets/8ebe8bf5-16ab-4652-b4d3-47507c2d3673\r\n\r\nhttps://github.com//issues/201702\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"c7b5b35b199611741993e124811352472e8323f2"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Philippe Oberti <[email protected]>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Nov 26, 2024
…r lacks privileges (elastic#201707)

## Summary

This PR fixes a small issue where users could click on the add button in
the alert details flyout even if they did not have the correct
privileges.

When the user has the correct privileges, the UI does not change. In the
flyout:
- if no notes have previously been created for the document, we show a
`Add note` button
- if some notes have previously been created for the document, we show
the number of notes and a plus button icon


https://github.com/user-attachments/assets/d9a27b70-99b1-4562-8224-4f5c2f25b001

When the user does not have the correct privileges, the flyout UI now
shows the following:
- if no notes have previously been created for the document, we show a
`-`
- if one or more notes have been created for the document, we show the
number of notes followed by a `View note(s)` button, that - when clicked
- opens the left panel for the user to view the notes


https://github.com/user-attachments/assets/8ebe8bf5-16ab-4652-b4d3-47507c2d3673

elastic#201702

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
…r lacks privileges (elastic#201707)

## Summary

This PR fixes a small issue where users could click on the add button in
the alert details flyout even if they did not have the correct
privileges.

When the user has the correct privileges, the UI does not change. In the
flyout:
- if no notes have previously been created for the document, we show a
`Add note` button
- if some notes have previously been created for the document, we show
the number of notes and a plus button icon


https://github.com/user-attachments/assets/d9a27b70-99b1-4562-8224-4f5c2f25b001

When the user does not have the correct privileges, the flyout UI now
shows the following:
- if no notes have previously been created for the document, we show a
`-`
- if one or more notes have been created for the document, we show the
number of notes followed by a `View note(s)` button, that - when clicked
- opens the left panel for the user to view the notes


https://github.com/user-attachments/assets/8ebe8bf5-16ab-4652-b4d3-47507c2d3673

elastic#201702

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:fix Team:Threat Hunting:Investigations Security Solution Investigations Team v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants