-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cases] API to return a case's connectors information (#147295)
This PR implements a new internal API to return the information relating to all the connectors used throughout a case's lifespan. Fixes: #134346 ``` GET http://localhost:5601/internal/cases/<case id>/_connectors Response { "my-jira": { "name": "preconfigured-jira", "type": ".jira", "fields": { "issueType": "10001", "parent": null, "priority": null }, "id": "my-jira", "needsToBePushed": true, "hasBeenPushed": false } } ``` <details><summary>cURL example</summary> ``` curl --location --request GET 'http://localhost:5601/internal/cases/ae038370-91d9-11ed-97ce-c35961718f7b/_connectors' \ --header 'kbn-xsrf: hello' \ --header 'Authorization: Basic <token>' \ --data-raw '' ``` Response ``` { "my-jira": { "name": "preconfigured-jira", "type": ".jira", "fields": { "issueType": "10001", "parent": null, "priority": null }, "id": "my-jira", "needsToBePushed": true, "hasBeenPushed": false } } ``` </details> Notable changes: - Refactored the user actions service to move the functions that create user actions (builders etc) to its own class `UserActionPersister` - Refactored the `CaseUserActionService` class to pull the saved object client, logger, and other fields passed to each function via parameters to be wrapped in a `context` member field within the class - Plumbed in `savedObjectsService.createSerializer` to transform a raw elasticsearch document into the saved object representation - Added new internal `_connectors` route and `getConnectors` client function - Refactored the integration tests by extracting the connector related utility functions into their own file ## Needs to be pushed algorithm To determine whether a case needs to be pushed for a certain connector we follow this algorithm: - Get all unique connectors - For each connector - Find the most recent user action contain the connector's fields, this will be in the most recent `connector` user action or if the connector was configured only once when the case was initially created it'll be on the `create_case` user action - Grab the most recent push user action if it exists - For each push search for the connector fields that were used in that push - Get the most recent user action that would cause a push to occur (title, description, tags, or comment change) - For each connector - If a push does not exist, we need to push - If a push exists but the fields do not match the field of the most recent connector fields, we need to push because the fields changed - If the timestamp of the most recent user action is more recent than that of the last push (aka the user changed something since we last pushed) we need to push Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
b345f75
commit 92418a6
Showing
44 changed files
with
2,481 additions
and
771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
x-pack/plugins/cases/server/authorization/__snapshots__/audit_logger.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.