Skip to content

Commit

Permalink
feat: add bulk update p ermission check
Browse files Browse the repository at this point in the history
Signed-off-by: tygao <tygao@amazon.com>
  • Loading branch information
raintygao committed Jul 24, 2023
1 parent 6af0dbe commit 6255127
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ export class WorkspaceSavedObjectsClientWrapper {
objects: Array<SavedObjectsBulkUpdateObject<T>>,
options: SavedObjectsBulkUpdateOptions = {}
) => {
const objectToBulkUpdate = await wrapperOptions.client.bulkGet<T>(objects, options);
for (const object of objectToBulkUpdate.saved_objects) {
if (isWorkspacesLikeAttributes(object.attributes)) {
await this.validateMultiWorkspacesPermissions(
object.attributes.workspaces,
wrapperOptions.request,
WorkspacePermissionMode.Admin
);
}
}
return await wrapperOptions.client.bulkUpdate(objects, options);
};

Expand Down

0 comments on commit 6255127

Please sign in to comment.