Skip to content

Commit

Permalink
fix: incorrect permission modes when checking workspace permissions (o…
Browse files Browse the repository at this point in the history
…pensearch-project#98)

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe committed Aug 31, 2023
1 parent 006fa67 commit 2e2479e
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class WorkspaceSavedObjectsClientWrapper {
await this.validateMultiWorkspacesPermissions(
objectToDeleted.workspaces,
wrapperOptions.request,
WorkspacePermissionMode.Management
[WorkspacePermissionMode.LibraryWrite, WorkspacePermissionMode.Management]
);
return await wrapperOptions.client.delete(type, id, options);
};
Expand Down Expand Up @@ -238,7 +238,7 @@ export class WorkspaceSavedObjectsClientWrapper {
await this.validateMultiWorkspacesPermissions(
attributes.workspaces,
wrapperOptions.request,
WorkspacePermissionMode.Management
[WorkspacePermissionMode.LibraryWrite, WorkspacePermissionMode.Management]
);
}
return await wrapperOptions.client.create(type, attributes, options);
Expand All @@ -253,7 +253,11 @@ export class WorkspaceSavedObjectsClientWrapper {
await this.validateAtLeastOnePermittedWorkspaces(
objectToGet.workspaces,
wrapperOptions.request,
WorkspacePermissionMode.Read
[
WorkspacePermissionMode.LibraryRead,
WorkspacePermissionMode.LibraryWrite,
WorkspacePermissionMode.Management,
]
);
return objectToGet;
};
Expand All @@ -267,7 +271,11 @@ export class WorkspaceSavedObjectsClientWrapper {
await this.validateAtLeastOnePermittedWorkspaces(
object.workspaces,
wrapperOptions.request,
WorkspacePermissionMode.Read
[
WorkspacePermissionMode.LibraryRead,
WorkspacePermissionMode.LibraryWrite,
WorkspacePermissionMode.Management,
]
);
}
return objectToBulkGet;
Expand Down

0 comments on commit 2e2479e

Please sign in to comment.