Skip to content

[Security Solution][Entity Analytics][UI] Adding code to check privileges for enabling the Run Engine button#213054

Merged
abhishekbhatia1710 merged 40 commits intoelastic:mainfrom
abhishekbhatia1710:ea-12016-privileges-check-for-run-engine-button
Apr 25, 2025
Merged

[Security Solution][Entity Analytics][UI] Adding code to check privileges for enabling the Run Engine button#213054
abhishekbhatia1710 merged 40 commits intoelastic:mainfrom
abhishekbhatia1710:ea-12016-privileges-check-for-run-engine-button

Conversation

@abhishekbhatia1710
Copy link
Contributor

@abhishekbhatia1710 abhishekbhatia1710 commented Mar 4, 2025

Summary

What: Updated the EntityAnalyticsManagementPage component to enhance user privilege checks and disable the "Run Engine" button when necessary conditions are not met.

Why: To improve UI/UX by preventing users from attempting actions they don’t have the required privileges for, ensuring a clearer user experience by displaying errors when required.

Test Steps

  • Open Kibana and enable the risk engine
  • Create a user with no cluster privileges
  • Login with the no-privileges user
    • Go to the Entity Risk Score page
    • The Run Engine button should be disabled.
  • Login now with the "elastic" user.
    • Go to the Entity Risk Score page
    • The Run Engine button should be enabled
    • Clicking the Run Engine button should update the countdown text to 'Now running' and
      disable the button.

Screenshots

The "Run Engine" button is enabled, but an error is displayed, and the scheduleRiskEngine API call is not triggered.

Screenshot 2025-03-04 at 3 13 55 PMcluster privileges

The "Run Engine" button is disabled because the user lacks the required privileges.

Screenshot 2025-03-04 at 3 04 22 PM

User with all the privileges

Screenshot 2025-03-04 at 3 17 38 PM

Run Engine button is disabled when countdown text shows "Now running" (for admin user)

Screen.Recording.2025-03-21.at.3.04.16.PM.mov

Run Engine button is disabled when countdown text shows "Now running" (for user without manage_index_templates privilege)

Screen.Recording.2025-03-21.at.3.03.08.PM.mov

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@abhishekbhatia1710 abhishekbhatia1710 added release_note:fix Team:Entity Analytics Security Entity Analytics Team backport:version Backport to applied version labels v9.1.0 labels Mar 4, 2025
@abhishekbhatia1710 abhishekbhatia1710 self-assigned this Mar 4, 2025
@abhishekbhatia1710 abhishekbhatia1710 requested a review from a team as a code owner March 4, 2025 09:55
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

@abhishekbhatia1710
Copy link
Contributor Author

I've updated the logic to disable the 'Run Engine' button when the countdown text displays 'Now running.'

Attached are the screenshots, along with testing steps detailed in the PR description.

Using different methods for enable and run risk engine for privilege check
Copy link
Contributor

@hop-dev hop-dev left a comment

Choose a reason for hiding this comment

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

Please see comments 👍

Copy link
Member

@machadoum machadoum left a comment

Choose a reason for hiding this comment

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

I desk-tested!

The only issue I noticed is UX related and could be addressed later:

Placing dynamic text and a loader next to a button, on a right-aligned design, is a bad pattern. The text and loader vary in size, which makes the button move. That makes it harder to click and creates a confusing user experience.

Apr-25-2025.14-52-11.mov

@machadoum machadoum removed the request for review from hop-dev April 25, 2025 13:27
@abhishekbhatia1710 abhishekbhatia1710 dismissed hop-dev’s stale review April 25, 2025 13:32

Mark reviewed already, hence dismissing (with his blessing, ofcourse)

@abhishekbhatia1710 abhishekbhatia1710 merged commit 12c3433 into elastic:main Apr 25, 2025
9 checks passed
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 29, 2025
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 213054 locally
cc: @abhishekbhatia1710

2 similar comments
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 213054 locally
cc: @abhishekbhatia1710

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 213054 locally
cc: @abhishekbhatia1710

@abhishekbhatia1710
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.0
8.19
8.18

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

Questions ?

Please refer to the Backport tool documentation

abhishekbhatia1710 added a commit to abhishekbhatia1710/kibana that referenced this pull request May 2, 2025
…eges for enabling the Run Engine button (elastic#213054)

## Summary

**What:** Updated the `EntityAnalyticsManagementPage` component to
enhance user privilege checks and disable the "Run Engine" button when
necessary conditions are not met.

**Why:** To improve UI/UX by preventing users from attempting actions
they don’t have the required privileges for, ensuring a clearer user
experience by displaying errors when required.

## Test Steps
- Open Kibana and enable the risk engine
- Create a user with no cluster privileges
- Login with the no-privileges user
  - Go to the Entity Risk Score page
  - The Run Engine button should be disabled.
- Login now with the "elastic" user.
  - Go to the Entity Risk Score page
  - The Run Engine button should be enabled
- Clicking the Run Engine button should update the countdown text to
'Now running' and
    disable the button.

## Screenshots

### The "Run Engine" button is enabled, but an error is displayed, and
the `scheduleRiskEngine` API call is not triggered.

![Screenshot 2025-03-04 at 3 13
55 PM](https://github.com/user-attachments/assets/43b772d8-4782-45b8-93b2-9dec2af02c30)cluster
privileges

### The "Run Engine" button is disabled because the user lacks the
required privileges.

![Screenshot 2025-03-04 at 3 04
22 PM](https://github.com/user-attachments/assets/812653ec-d8db-4e7b-87f1-596e3eb8845c)

### User with all the privileges
![Screenshot 2025-03-04 at 3 17
38 PM](https://github.com/user-attachments/assets/82b7f5bc-438d-489c-a56e-13b1eb63acbf)

### Run Engine button is disabled when countdown text shows "Now
running" (for admin user)

https://github.com/user-attachments/assets/8d1279f1-6d4c-44b2-b7a8-75e5114af73b

### Run Engine button is disabled when countdown text shows "Now
running" (for user without `manage_index_templates` privilege)

https://github.com/user-attachments/assets/bb207a23-ae0a-4eb9-8400-ea023a47bb4c

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] 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/src/platform/packages/shared/kbn-i18n/README.md)
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit 12c3433)
abhishekbhatia1710 added a commit to abhishekbhatia1710/kibana that referenced this pull request May 2, 2025
…eges for enabling the Run Engine button (elastic#213054)

## Summary

**What:** Updated the `EntityAnalyticsManagementPage` component to
enhance user privilege checks and disable the "Run Engine" button when
necessary conditions are not met.

**Why:** To improve UI/UX by preventing users from attempting actions
they don’t have the required privileges for, ensuring a clearer user
experience by displaying errors when required.

## Test Steps
- Open Kibana and enable the risk engine
- Create a user with no cluster privileges
- Login with the no-privileges user
  - Go to the Entity Risk Score page
  - The Run Engine button should be disabled.
- Login now with the "elastic" user.
  - Go to the Entity Risk Score page
  - The Run Engine button should be enabled
- Clicking the Run Engine button should update the countdown text to
'Now running' and
    disable the button.

## Screenshots

### The "Run Engine" button is enabled, but an error is displayed, and
the `scheduleRiskEngine` API call is not triggered.

![Screenshot 2025-03-04 at 3 13
55 PM](https://github.com/user-attachments/assets/43b772d8-4782-45b8-93b2-9dec2af02c30)cluster
privileges

### The "Run Engine" button is disabled because the user lacks the
required privileges.

![Screenshot 2025-03-04 at 3 04
22 PM](https://github.com/user-attachments/assets/812653ec-d8db-4e7b-87f1-596e3eb8845c)

### User with all the privileges
![Screenshot 2025-03-04 at 3 17
38 PM](https://github.com/user-attachments/assets/82b7f5bc-438d-489c-a56e-13b1eb63acbf)

### Run Engine button is disabled when countdown text shows "Now
running" (for admin user)

https://github.com/user-attachments/assets/8d1279f1-6d4c-44b2-b7a8-75e5114af73b

### Run Engine button is disabled when countdown text shows "Now
running" (for user without `manage_index_templates` privilege)

https://github.com/user-attachments/assets/bb207a23-ae0a-4eb9-8400-ea023a47bb4c

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] 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/src/platform/packages/shared/kbn-i18n/README.md)
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit 12c3433)
abhishekbhatia1710 added a commit to abhishekbhatia1710/kibana that referenced this pull request May 2, 2025
…eges for enabling the Run Engine button (elastic#213054)

## Summary

**What:** Updated the `EntityAnalyticsManagementPage` component to
enhance user privilege checks and disable the "Run Engine" button when
necessary conditions are not met.

**Why:** To improve UI/UX by preventing users from attempting actions
they don’t have the required privileges for, ensuring a clearer user
experience by displaying errors when required.

## Test Steps
- Open Kibana and enable the risk engine
- Create a user with no cluster privileges
- Login with the no-privileges user
  - Go to the Entity Risk Score page
  - The Run Engine button should be disabled.
- Login now with the "elastic" user.
  - Go to the Entity Risk Score page
  - The Run Engine button should be enabled
- Clicking the Run Engine button should update the countdown text to
'Now running' and
    disable the button.

## Screenshots

### The "Run Engine" button is enabled, but an error is displayed, and
the `scheduleRiskEngine` API call is not triggered.

![Screenshot 2025-03-04 at 3 13
55 PM](https://github.com/user-attachments/assets/43b772d8-4782-45b8-93b2-9dec2af02c30)cluster
privileges

### The "Run Engine" button is disabled because the user lacks the
required privileges.

![Screenshot 2025-03-04 at 3 04
22 PM](https://github.com/user-attachments/assets/812653ec-d8db-4e7b-87f1-596e3eb8845c)

### User with all the privileges
![Screenshot 2025-03-04 at 3 17
38 PM](https://github.com/user-attachments/assets/82b7f5bc-438d-489c-a56e-13b1eb63acbf)

### Run Engine button is disabled when countdown text shows "Now
running" (for admin user)

https://github.com/user-attachments/assets/8d1279f1-6d4c-44b2-b7a8-75e5114af73b

### Run Engine button is disabled when countdown text shows "Now
running" (for user without `manage_index_templates` privilege)

https://github.com/user-attachments/assets/bb207a23-ae0a-4eb9-8400-ea023a47bb4c

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] 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/src/platform/packages/shared/kbn-i18n/README.md)
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit 12c3433)
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @abhishekbhatia1710

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @abhishekbhatia1710

6 similar comments
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @abhishekbhatia1710

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @abhishekbhatia1710

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @abhishekbhatia1710

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @abhishekbhatia1710

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @abhishekbhatia1710

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @abhishekbhatia1710

@abhishekbhatia1710 abhishekbhatia1710 added backport:skip This PR does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. backport:version Backport to applied version labels v9.1.0 labels May 14, 2025
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…eges for enabling the Run Engine button (elastic#213054)

## Summary

**What:** Updated the `EntityAnalyticsManagementPage` component to
enhance user privilege checks and disable the "Run Engine" button when
necessary conditions are not met.

**Why:** To improve UI/UX by preventing users from attempting actions
they don’t have the required privileges for, ensuring a clearer user
experience by displaying errors when required.

## Test Steps
- Open Kibana and enable the risk engine
- Create a user with no cluster privileges
- Login with the no-privileges user
  - Go to the Entity Risk Score page
  - The Run Engine button should be disabled.
- Login now with the "elastic" user.
  - Go to the Entity Risk Score page
  - The Run Engine button should be enabled
- Clicking the Run Engine button should update the countdown text to
'Now running' and
    disable the button.

## Screenshots

### The "Run Engine" button is enabled, but an error is displayed, and
the `scheduleRiskEngine` API call is not triggered.

![Screenshot 2025-03-04 at 3 13
55 PM](https://github.com/user-attachments/assets/43b772d8-4782-45b8-93b2-9dec2af02c30)cluster
privileges

### The "Run Engine" button is disabled because the user lacks the
required privileges.

![Screenshot 2025-03-04 at 3 04
22 PM](https://github.com/user-attachments/assets/812653ec-d8db-4e7b-87f1-596e3eb8845c)


### User with all the privileges 
![Screenshot 2025-03-04 at 3 17
38 PM](https://github.com/user-attachments/assets/82b7f5bc-438d-489c-a56e-13b1eb63acbf)


### Run Engine button is disabled when countdown text shows "Now
running" (for admin user)



https://github.com/user-attachments/assets/8d1279f1-6d4c-44b2-b7a8-75e5114af73b

### Run Engine button is disabled when countdown text shows "Now
running" (for user without `manage_index_templates` privilege)



https://github.com/user-attachments/assets/bb207a23-ae0a-4eb9-8400-ea023a47bb4c



### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] 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/src/platform/packages/shared/kbn-i18n/README.md)
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:fix Team:Entity Analytics Security Entity Analytics Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants