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

[Cases] Cases assignees sub feature #201654

Merged
merged 58 commits into from
Jan 30, 2025

Conversation

kqualters-elastic
Copy link
Contributor

@kqualters-elastic kqualters-elastic commented Nov 25, 2024

Summary

This pr implements a new cases assignee sub-feature, allowing users to control a role's ability to change the assignee of a case. With the permission enabled, they can assign any user to any case, with it disabled, the assignees component is hidden.

Read only + enabled:
image

All + assign disabled:
image

Checklist

@kqualters-elastic kqualters-elastic added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0 release_note:feature Makes this part of the condensed release notes Team:Threat Hunting:Investigations Security Solution Investigations Team v8.18.0 labels Nov 25, 2024
@kqualters-elastic kqualters-elastic changed the title [WIP] [Cases] Cases assignees [Cases] Cases assignees sub feature Dec 12, 2024
@kqualters-elastic kqualters-elastic marked this pull request as ready for review December 12, 2024 22:03
@kqualters-elastic kqualters-elastic requested review from a team as code owners December 12, 2024 22:03
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

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

@kqualters-elastic kqualters-elastic added the backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) label Dec 12, 2024
@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Dec 12, 2024
@kqualters-elastic
Copy link
Contributor Author

@kc13greiner updated

user: obsCasesOnlyDeleteUser,
owner: OBSERVABILITY_APP_ID,
userWithFullPerms: obsCasesAllUser,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think V3 variants of users: casesNoDelete, obsCasesNoDelete, and secAllCasesNoDelete (the names are sort of misleading, the have the minimal_all privilege) should be added here.

{ user: obsCasesV2AllUser, owner: OBSERVABILITY_APP_ID },
{ user: secCasesV3AllUser, owner: SECURITY_SOLUTION_APP_ID },
{ user: casesV3AllUser, owner: CASES_APP_ID },
{ user: obsCasesV3AllUser, owner: OBSERVABILITY_APP_ID },
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think V1 and V2 variants of users: casesNoDelete, obsCasesNoDelete, and secAllCasesNoDelete (the names are sort of misleading, the have the minimal_all privilege) should be added here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that I agree with, I think I was just trying to avoid a permutation explosion in these test names, this is quickly going to become untenable how it currently works, i.e. secCasesV3MinAllWithSettingsWithoutCommentWithReopenWithoutDeleteWithAssign ha

@kc13greiner
Copy link
Contributor

@kc13greiner ya I updated the 2 solution definitions as well, all should be in sync. As for the tests, since these are ultimately just a static blob of json, there aren't really any unit level tests that 'know' exactly what should/shouldn't be in each, as the json blob is the source of truth itself. I've just been relying on the integration tests in x-pack/test/api_integration/apis/cases, x-pack/test/cases_api_integration, & x-pack/test/security_api_integration/tests/features, with most in x-pack/test/api_integration/apis/cases, although clearly there's not a test that should have been failing for that improper configuration I had in this pr for a while now.

@kqualters-elastic I found the tests I was looking for 👍 I added a few suggestions to help cover the minimal_all

Changes to the the V1/2/3 of all types LGTM.

Thank you for making all those changes!

Copy link
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

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

Left a few suggestions above for improved test coverage of minimal_all

Overall LGTM - great work!

@michaelolo24
Copy link
Contributor

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 30, 2025

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
cases 105 109 +4
observability 689 690 +1
total +5

Async chunks

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

id before after diff
cases 540.5KB 540.8KB +263.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cases 162.2KB 162.5KB +318.0B
observability 102.1KB 102.1KB +74.0B
observabilityShared 93.9KB 93.9KB +20.0B
total +412.0B
Unknown metric groups

API count

id before after diff
cases 125 129 +4
observability 697 698 +1
total +5

ESLint disabled line counts

id before after diff
cases 63 64 +1

References to deprecated APIs

id before after diff
ml 57 60 +3

Total ESLint disabled count

id before after diff
cases 81 82 +1

History

@kqualters-elastic kqualters-elastic enabled auto-merge (squash) January 30, 2025 16:03
@kqualters-elastic kqualters-elastic merged commit 0e7c608 into elastic:main Jan 30, 2025
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 201654

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 3, 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 201654 locally

@kobelb
Copy link
Contributor

kobelb commented Feb 3, 2025

I just updated the labels on this PR. It didn't merge before the 9.0/8.18 feature freeze, and the backport to 8.x failed. Right now, this change will only be included in 9.1. I'm assuming that we'll be fixing the backport, so I added the 8.19 label.

@kqualters-elastic
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.18

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

Questions ?

Please refer to the Backport tool documentation

@kqualters-elastic
Copy link
Contributor Author

💔 Some backports could not be created

Status Branch Result
9.0 Cherrypick failed because the selected commit (0e7c608) is empty. Did you already backport this commit?
8.x

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

Manual backport

To create the backport manually run:

node scripts/backport --pr 201654

Questions ?

Please refer to the Backport tool documentation

kqualters-elastic added a commit to kqualters-elastic/kibana that referenced this pull request Feb 4, 2025
## Summary

This pr implements a new cases assignee sub-feature, allowing users to
control a role's ability to change the assignee of a case. With the
permission enabled, they can assign any user to any case, with it
disabled, the assignees component is hidden.

Read only + enabled:

![image](https://github.com/user-attachments/assets/ba421784-d976-4ae9-a399-e404c26b3842)

All + assign disabled:

![image](https://github.com/user-attachments/assets/d835b6f9-5a14-4ae0-abed-b3c3252c2692)

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [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

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 0e7c608)

# Conflicts:
#	x-pack/platform/plugins/shared/cases/server/client/cases/bulk_update.test.ts
#	x-pack/platform/plugins/shared/features/server/__snapshots__/oss_features.test.ts.snap
#	x-pack/test/api_integration/apis/cases/common/roles.ts
#	x-pack/test/api_integration/apis/cases/common/users.ts
#	x-pack/test/api_integration/apis/cases/privileges.ts
#	x-pack/test/security_api_integration/tests/features/deprecated_features.ts
#	x-pack/test/spaces_api_integration/common/suites/get.ts
@kqualters-elastic
Copy link
Contributor Author

@kobelb I think it made it in to 9.0 bc1, but not 8.18: https://github.com/elastic/kibana/commits/fd1f8b62137f14e93716e298e4e931b576e2ca13 for 9.0 vs
https://github.com/elastic/kibana/commits/33e6754d67870b0e403266b752c3973539506cc6 for 8.18 (and as the backport above is still open). The 8.18 backport in particular gave me a bunch of issues locally, and now is failing on buildkite with an error that seems completely unrelated:

ERROR Failed to capture OAS: {
--
  | "errno": -28,
  | "code": "ENOSPC",
  | "syscall": "mkdir",
  | "path": "/opt/buildkite-agent/builds/bk-agent-prod-gcp-1738636880036796160/elastic/kibana-pull-request/kibana/.es/es-test-cluster/ES_TMPDIR"
  | }
  | ERROR UNHANDLED ERROR
  | ERROR Error: ENOSPC: no space left on device, mkdir '/opt/buildkite-agent/builds/bk-agent-prod-gcp-1738636880036796160/elastic/kibana-pull-request/kibana/.es/es-test-cluster/ES_TMPDIR'

I think it would be ok to include in 8.18 BC2 as long as CI passes eventually, given that it's in 9.0 already, but if anyone disagrees I can close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport missing Added to PRs automatically when the are determined to be missing a backport. backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) ci:project-deploy-observability Create an Observability project release_note:feature Makes this part of the condensed release notes Team:obs-ux-management Observability Management User Experience Team Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Team:Threat Hunting:Investigations Security Solution Investigations Team v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.