Add tagging capability to saved objects
In addition to use the UI api to plug the tagging feature in your application, there is a couple things that needs to be done on the server:
In order to be able to fetch the tags assigned to an object, the user must have read permission
for the tag
saved object type. Which is why all features relying on SO tagging must update
their capabilities.
features.registerKibanaFeature({
id: 'myFeature',
// ...
privileges: {
all: {
// ...
savedObject: {
all: ['some-type'],
read: ['tag'], // <-- HERE
},
},
read: {
// ...
savedObject: {
all: [],
read: ['some-type', 'tag'], // <-- AND HERE
},
},
},
});
The schema is located here: x-pack/plugins/saved_objects_tagging/server/usage/schema.ts
. You
just need to add the name of the SO type you are adding.
export const tagUsageCollectorSchema: MakeSchemaFrom<TaggingUsageData> = {
// ...
types: {
dashboard: perTypeSchema,
visualization: perTypeSchema,
// <-- add your type here
},
};
Edit the taggableTypes
list in x-pack/plugins/saved_objects_tagging/common/constants.ts
to add
the name of the type you are adding.