Skip to content

Commit

Permalink
feat: do not append workspaces field when no workspaces present (#6)
Browse files Browse the repository at this point in the history
* feat: do not append workspaces field when no workspaces present

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: do not append workspaces field when no workspaces present

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe authored Mar 7, 2024
1 parent e7279f9 commit 7ba2d5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,6 @@ describe('WorkspaceSavedObjectsClientWrapper', () => {
});
expect(clientMock.find).toHaveBeenCalledWith({
type: 'dashboard',
workspaces: ['workspace-1'],
workspacesSearchOperator: 'OR',
ACLSearchParams: {
permissionModes: ['read', 'write'],
principals: { users: ['user-1'] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,9 @@ export class WorkspaceSavedObjectsClientWrapper {
options.workspaces = permittedWorkspaces;
} else {
/**
* Select all the docs that
* 1. ACL matches read / write / user passed permission OR
* 2. workspaces matches library_read or library_write OR
* If no workspaces present, find all the docs that
* ACL matches read / write / user passed permission
*/
options.workspaces = permittedWorkspaceIds;
options.workspacesSearchOperator = 'OR';
options.ACLSearchParams.permissionModes = getDefaultValuesForEmpty(
options.ACLSearchParams.permissionModes,
[WorkspacePermissionMode.Read, WorkspacePermissionMode.Write]
Expand Down

0 comments on commit 7ba2d5e

Please sign in to comment.