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

When un-sharing saved objects, referenced objects are un-shared when they are still needed #168657

Closed
jeramysoucy opened this issue Oct 11, 2023 · 9 comments · Fixed by #169177
Closed
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Saved Objects Feature:Security/Spaces Platform Security - Spaces feature Project:ShareToSpace Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.11.0

Comments

@jeramysoucy
Copy link
Contributor

jeramysoucy commented Oct 11, 2023

Kibana versions: 8.11.0, main

Describe the bug:

When un-sharing a saved object, referenced saved objects are also unshared even if they are still referenced by another object.
For example, when multiple saved queries that use the same data view are share to a different space. When un-sharing one of the saved queries, the related data view is automatically also un-shared, leaving the second saved query in place with no data view.

Steps to reproduce:

  • Add Sample data logs to Kibana
  • Create a saved query with a filter pill that uses the sample data logs data view
  • Create a second saved query with a filter pill that also uses the sample data logs data view
  • Create a new space
  • From the default space, share the first saved query with the new space
  • Then share the second saved query with the same new space (Fixes conflict checks for sharing saved objects #168655 will need to be merged for this to work)
  • Un-share one of the saved queries

Expected behavior:

There are two options:

  1. Un-share referenced objects only when they are not referenced by any other object.
  2. Never un-share referenced objects just in case they are used in weak links, or in the event that the references were added after the objects were originally shared (and not a result of the share). Require that each object be explicitly un-shared.

Based on the comments in this issue, the ideal behavior is option 2.

@jeramysoucy jeramysoucy added bug Fixes for quality problems that affect the customer experience Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! Feature:Saved Objects Feature:Security/Spaces Platform Security - Spaces feature v8.11.0 labels Oct 11, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@teresaalvarezsoler
Copy link

Thanks @jeramysoucy. If users have a shared dashboard that has drilldowns to other dashboards that use the same and/or different dataviews, when un-sharing the dashboard, will the related dashboards and the dataviews also be unshared?

@nickpeihl
Copy link
Member

IMO, we probably should not be automatically unsharing any referenced objects, even if there are no other objects referencing it.

For example, the new Links panel contains references to other dashboards. If a Links saved object is unshared from a space, we most likely don't want to also automatically unshare the dashboards from the same space.

@jeramysoucy
Copy link
Contributor Author

If users have a shared dashboard that has drilldowns to other dashboards that use the same and/or different dataviews, when un-sharing the dashboard, will the related dashboards and the dataviews also be unshared?

@teresaalvarezsoler As it is implemented right now, it appears any related objects that are referenced by ID would get un-shared. I understand this is not the desired behavior. I tried to prove out the example you described, but I couldn't find a way (via the UI) to share a dashboard to another space. Is this currently possible?

@nickpeihl
Copy link
Member

@jeramysoucy Dashboards are not currently shareable in main. We have a working PoC for making dashboards (as well as Lens, Maps, and Saved searches) shareable in this PR.

Let me know if you have any questions about this.

@jeramysoucy jeramysoucy changed the title When un-sharing saved objects, referenced objects are un-shared when they still needed When un-sharing saved objects, referenced objects are un-shared when they are still needed Oct 12, 2023
@jeramysoucy
Copy link
Contributor Author

IMO, we probably should not be automatically unsharing any referenced objects, even if there are no other objects referencing it.

@nickpeihl @teresaalvarezsoler I have updated the issue description to include expected behavior.

@teresaalvarezsoler
Copy link

Thank you @jeramysoucy, number 2 in the description solves the issues raised. However, I'm wondering if this behaviour is too complex for users to understand/predict. I think it would be better to unshare only the specific object and not any others related. Btw, this is also how deletion works, when users delete a share object, all the related objects stay in the spaces. What do you think? We can also check with the UX/design team on this.

@jeramysoucy
Copy link
Contributor Author

I think it would be better to unshare only the specific object and not any others related.

@teresaalvarezsoler This is what I meant in option 2 by "Require that each object be explicitly un-shared." I agree, that seems to be the best option. And knowing that it aligns with how deletion works, it's probably closest to what a user will expect.

We can also check with the UX/design team on this.

Yes, I think we should. @elastic/ux what do you think?

@MichaelMarcialis
Copy link
Contributor

Option 2 makes sense from my perspective.

jeramysoucy added a commit that referenced this issue Oct 23, 2023
…ce action (#169177)

closes #168657

## Summary

Updates the `share to spaces` action to refrain from removing spaces
from related objects (objects referenced by the target object).

I have also updated the description of issue #130562, which essentially
will replace much of the client-side implementation of this action, to
explicitly include this behavior.

### Manual Testing
- Create 2 spaces: A and B
- Add a sample data set (e.g. flight) to space A
- In Discover, create a saved query called "s1" (add a filter that uses
the sample data logs data view, and use the filter menu button)
- Go to `Stack Management->Saved` Objects and share the "s1" query to
space B
- Verify that the related data view is also shared to space B.
- Un-share the "s1" query from space B
- Verify that the related data view is still shared to space B.

### Automated Tests
-
x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx

---------

Co-authored-by: kibanamachine <[email protected]>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Oct 23, 2023
…ce action (elastic#169177)

closes elastic#168657

## Summary

Updates the `share to spaces` action to refrain from removing spaces
from related objects (objects referenced by the target object).

I have also updated the description of issue elastic#130562, which essentially
will replace much of the client-side implementation of this action, to
explicitly include this behavior.

### Manual Testing
- Create 2 spaces: A and B
- Add a sample data set (e.g. flight) to space A
- In Discover, create a saved query called "s1" (add a filter that uses
the sample data logs data view, and use the filter menu button)
- Go to `Stack Management->Saved` Objects and share the "s1" query to
space B
- Verify that the related data view is also shared to space B.
- Un-share the "s1" query from space B
- Verify that the related data view is still shared to space B.

### Automated Tests
-
x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 4af9175)
kibanamachine added a commit that referenced this issue Oct 23, 2023
… to space action (#169177) (#169566)

# Backport

This will backport the following commits from `main` to `8.11`:
- [Fixes issue with removing spaces from related objects in share to
space action (#169177)](#169177)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Jeramy
Soucy","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-23T18:45:36Z","message":"Fixes
issue with removing spaces from related objects in share to space action
(#169177)\n\ncloses #168657\r\n\r\n## Summary\r\n\r\nUpdates the `share
to spaces` action to refrain from removing spaces\r\nfrom related
objects (objects referenced by the target object).\r\n\r\nI have also
updated the description of issue #130562, which essentially\r\nwill
replace much of the client-side implementation of this action,
to\r\nexplicitly include this behavior.\r\n\r\n### Manual Testing\r\n-
Create 2 spaces: A and B\r\n- Add a sample data set (e.g. flight) to
space A\r\n- In Discover, create a saved query called \"s1\" (add a
filter that uses\r\nthe sample data logs data view, and use the filter
menu button)\r\n- Go to `Stack Management->Saved` Objects and share the
\"s1\" query to\r\nspace B\r\n- Verify that the related data view is
also shared to space B.\r\n- Un-share the \"s1\" query from space B\r\n-
Verify that the related data view is still shared to space B.\r\n\r\n###
Automated
Tests\r\n-\r\nx-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"4af91754e02e1f055d4912b298fd0f7d68740b74","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","release_note:skip","backport:prev-minor","v8.11.0","v8.12.0"],"number":169177,"url":"https://github.com/elastic/kibana/pull/169177","mergeCommit":{"message":"Fixes
issue with removing spaces from related objects in share to space action
(#169177)\n\ncloses #168657\r\n\r\n## Summary\r\n\r\nUpdates the `share
to spaces` action to refrain from removing spaces\r\nfrom related
objects (objects referenced by the target object).\r\n\r\nI have also
updated the description of issue #130562, which essentially\r\nwill
replace much of the client-side implementation of this action,
to\r\nexplicitly include this behavior.\r\n\r\n### Manual Testing\r\n-
Create 2 spaces: A and B\r\n- Add a sample data set (e.g. flight) to
space A\r\n- In Discover, create a saved query called \"s1\" (add a
filter that uses\r\nthe sample data logs data view, and use the filter
menu button)\r\n- Go to `Stack Management->Saved` Objects and share the
\"s1\" query to\r\nspace B\r\n- Verify that the related data view is
also shared to space B.\r\n- Un-share the \"s1\" query from space B\r\n-
Verify that the related data view is still shared to space B.\r\n\r\n###
Automated
Tests\r\n-\r\nx-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"4af91754e02e1f055d4912b298fd0f7d68740b74"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/169177","number":169177,"mergeCommit":{"message":"Fixes
issue with removing spaces from related objects in share to space action
(#169177)\n\ncloses #168657\r\n\r\n## Summary\r\n\r\nUpdates the `share
to spaces` action to refrain from removing spaces\r\nfrom related
objects (objects referenced by the target object).\r\n\r\nI have also
updated the description of issue #130562, which essentially\r\nwill
replace much of the client-side implementation of this action,
to\r\nexplicitly include this behavior.\r\n\r\n### Manual Testing\r\n-
Create 2 spaces: A and B\r\n- Add a sample data set (e.g. flight) to
space A\r\n- In Discover, create a saved query called \"s1\" (add a
filter that uses\r\nthe sample data logs data view, and use the filter
menu button)\r\n- Go to `Stack Management->Saved` Objects and share the
\"s1\" query to\r\nspace B\r\n- Verify that the related data view is
also shared to space B.\r\n- Un-share the \"s1\" query from space B\r\n-
Verify that the related data view is still shared to space B.\r\n\r\n###
Automated
Tests\r\n-\r\nx-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"4af91754e02e1f055d4912b298fd0f7d68740b74"}}]}]
BACKPORT-->

Co-authored-by: Jeramy Soucy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Saved Objects Feature:Security/Spaces Platform Security - Spaces feature Project:ShareToSpace Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.11.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants