Add ability to share a saved-object in all current and future spaces #69808
Labels
enhancement
New value added to drive a business result
Feature:Saved Objects
Feature:Security/Sharing Saved Objects
Platform Security - Sharing Saved Objects feature
Team:Security
Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
This feature is based on the outcome of our investigation in #58756.
Overview
#27004 is an enhancement to allow Kibana's saved objects to be shared to multiple spaces. This feature is currently in the process of being implemented in multiple phases. In the current approach, consumers are required to specify each space explicitly.
We want to support the ability to share a saved object to all current and future spaces (defined as
'*'
). This supports several use cases, for example, importing Observability dashboards once that are visible in all spaces.Terminology
name
,id
, and a few other attributes. A space itself is namespace-agnostic.namespaces
array. For each string in an object'snamespaces
array, the object is said to exist in that namespace (even if there is no space with a matching ID).Technical Approach
A multi-namespace saved object has a
namespaces
array which contains a list of explicitly-defined namespaces. Each namespace string correlates to the space with the same ID.If a saved object exists in the
'*'
namespace, this will supersede all other namespaces, and the object is treated as if it exists in all spaces. Primarily this affects theSavedObjectsRepository
(responsible for CRUD operations to Elasticsearch) and theSecureSavedObjectsClientWrapper
(responsible for authorization checks).When using the UI to edit a saved object's shared spaces, the
addToNamespaces
API is always called before thedeleteFromNamespaces
API. This process will remain unchanged.Example of sharing to all spaces
Kibana has two spaces: the Default space, and the Other space. A dashboard exists in the Default space:
A user wants to share this dashboard to All Spaces. The client makes two API calls:
Later, the user is working in the Other space, and decides to unshare the dashboard from All Spaces. The client makes two more API calls:
Changes
The changes that will need to be made to implement this feature are as follows.
Server-side changes
getQueryParams
andSavedObjectsRepository
namespace handling: These need to be modified to handle the'*'
appropriately, treating it as if it is all namespaces.SavedObjectsRepository.delete
behavior: Currently, if you delete an object that exists in multiple namespaces, it will just remove the object from the current namespace. Otherwise, if the object only exists in one namespace, it will delete the object. To make this more consistent, we'll change this to always delete an object, but throw an error if the object exists in multiple namespaces or all spaces (this error can be overridden with a newforce
parameter).SavedObjectsRepository.create
andSavedObjectsRepository.bulkCreate
: Currently, when you create an object, it is transparently added to the current namespace. We'll change this so consumers can specify namespaces when an object is created.'/api/saved_objects/_create'
and'/api/saved_objects/_bulk_create'
: To expose the changes tocreate
andbulkCreate
to external consumers.copySavedObjectsToSpaces
andresolveCopySavedObjectsToSpacesConflicts
:These need to be changed to throw an error for any object that exists in all spaces, and omit any referenced objects that exist in all spaces.Update: we don't need to throw an error (this is an experimental API, the consumer just needs to be aware this is not allowed), and we don't need to omit any referenced objects (this has been added as a task in Phase 3 where we will support referential integrity).'/api/spaces/_share_saved_object_add'
and'/api/spaces/_share_saved_object_remove'
: These currently do not allow using the'*'
character in a space ID argument.Note: regardless of what operation is occurring, the user must be authorized to take the appropriate action in the current space. In theory you could attempt to create an object that exists in the Other space while in the context of the Default space; in that case you would need 'create' privileges in both spaces.
Client-side changes
The text was updated successfully, but these errors were encountered: