Skip to content

Commit

Permalink
apply workspace permission check when bulk creating object (opensearc…
Browse files Browse the repository at this point in the history
…h-project#66)

* feat: Apply workspace permission check when bulk creating object

Signed-off-by: tygao <[email protected]>

* chore: update bulk create function

Signed-off-by: tygao <[email protected]>

---------

Signed-off-by: tygao <[email protected]>
  • Loading branch information
raintygao authored and SuZhou-Joe committed Aug 31, 2023
1 parent 3ed2a7c commit 12a3cf2
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ export class WorkspaceSavedObjectsClientWrapper {
objects: Array<SavedObjectsBulkCreateObject<T>>,
options: SavedObjectsCreateOptions = {}
): Promise<SavedObjectsBulkResponse<T>> => {
if (options.workspaces) {
await this.validateMultiWorkspacesPermissions(options.workspaces, wrapperOptions.request, [
PermissionMode.Write,
PermissionMode.Management,
]);
}
return await wrapperOptions.client.bulkCreate(objects, options);
};

Expand Down

0 comments on commit 12a3cf2

Please sign in to comment.