Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply workspace permission check when bulk creating object #66

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

raintygao
Copy link
Collaborator

Description

apply workspace permission check when bulk creating object

Issues Resolved

Screenshot

Testing the changes

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov-commenter
Copy link

codecov-commenter commented Jul 28, 2023

Codecov Report

Merging #66 (b4a004f) into workspace (5337ad7) will increase coverage by 0.01%.
The diff coverage is 0.00%.

@@              Coverage Diff              @@
##           workspace      #66      +/-   ##
=============================================
+ Coverage      65.85%   65.86%   +0.01%     
=============================================
  Files           3341     3341              
  Lines          64386    64388       +2     
  Branches       10050    10051       +1     
=============================================
+ Hits           42402    42412      +10     
- Misses         19489    19509      +20     
+ Partials        2495     2467      -28     
Flag Coverage Δ
Linux_1 34.69% <ø> (ø)
Linux_3 42.80% <0.00%> (-0.01%) ⬇️
Windows_1 34.75% <ø> (+0.04%) ⬆️
Windows_2 54.57% <0.00%> (-0.01%) ⬇️
Windows_3 42.81% <0.00%> (-0.01%) ⬇️
Windows_4 34.78% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
..._objects/workspace_saved_objects_client_wrapper.ts 5.45% <0.00%> (-0.21%) ⬇️

... and 13 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -96,6 +96,16 @@ export class WorkspaceSavedObjectsClientWrapper {
objects: Array<SavedObjectsBulkCreateObject<T>>,
options: SavedObjectsCreateOptions = {}
): Promise<SavedObjectsBulkResponse<T>> => {
if (options.workspaces) {
options.workspaces = options.workspaces.filter(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that means the bulkCreate operation will be continued if user don't have permission to any one workspace? The options.workspaces will be empty, based current logic.

async (workspaceId) =>
await this.permissionControl.validate(
workspaceId,
WorkspacePermissionMode.Admin,
Copy link
Collaborator

@SuZhou-Joe SuZhou-Joe Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WorkspacePermissionMode.Admin,
[WorkspacePermissionMode.Write, WorkspacePermissionMode.Management],

Should be like this I think? Please rebase the latest code from workspace, the enum and validate function has some changes.

Signed-off-by: tygao <tygao@amazon.com>
@raintygao raintygao merged commit 93ebca8 into ruanyl:workspace Aug 2, 2023
44 of 47 checks passed
ruanyl pushed a commit that referenced this pull request Aug 3, 2023
* feat: Apply workspace permission check when bulk creating object

Signed-off-by: tygao <tygao@amazon.com>

* chore: update bulk create function

Signed-off-by: tygao <tygao@amazon.com>

---------

Signed-off-by: tygao <tygao@amazon.com>
SuZhou-Joe pushed a commit that referenced this pull request Aug 31, 2023
* feat: Apply workspace permission check when bulk creating object

Signed-off-by: tygao <tygao@amazon.com>

* chore: update bulk create function

Signed-off-by: tygao <tygao@amazon.com>

---------

Signed-off-by: tygao <tygao@amazon.com>
SuZhou-Joe pushed a commit that referenced this pull request Aug 31, 2023
* feat: Apply workspace permission check when bulk creating object

Signed-off-by: tygao <tygao@amazon.com>

* chore: update bulk create function

Signed-off-by: tygao <tygao@amazon.com>

---------

Signed-off-by: tygao <tygao@amazon.com>
ruanyl pushed a commit that referenced this pull request Sep 15, 2023
* feat: Apply workspace permission check when bulk creating object

Signed-off-by: tygao <tygao@amazon.com>

* chore: update bulk create function

Signed-off-by: tygao <tygao@amazon.com>

---------

Signed-off-by: tygao <tygao@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants