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

[Workspace] Isolate objects based on workspace when calling get/bulkGet #8888

Merged

Conversation

yubonluo
Copy link
Contributor

@yubonluo yubonluo commented Nov 19, 2024

Description

Isolate objects based on workspace when calling get/bulkGet

  1. Global operation (option/request workspace id is null): Return object;
  2. option.worksapces.length > 1: Throw error;
  3. Workspace operation:
    1. Object is data source:
      1. User is data source admin: Return object;
      2. Global data source: Do not return the object;
      3. Validate data source whether belongs to the workspace
    2. Other object:
      1. Global object: Return object;
      2. Validate object whether belongs to the workspace

Issues Resolved

Screenshot

No UI change

Testing the changes

Changelog

  • refactor: [Workspace] Isolate objects based on workspace when calling get/bulkGet

Check List

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

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 96.77419% with 1 line in your changes missing coverage. Please review.

Project coverage is 60.89%. Comparing base (ab4e6e8) to head (10cef9e).
Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
...ver/saved_objects/workspace_id_consumer_wrapper.ts 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8888      +/-   ##
==========================================
+ Coverage   60.85%   60.89%   +0.03%     
==========================================
  Files        3802     3802              
  Lines       91059    91083      +24     
  Branches    14376    14383       +7     
==========================================
+ Hits        55417    55467      +50     
+ Misses      32103    32074      -29     
- Partials     3539     3542       +3     
Flag Coverage Δ
Linux_1 29.02% <96.77%> (+0.01%) ⬆️
Linux_2 56.38% <ø> (-0.01%) ⬇️
Linux_3 37.90% <ø> (+0.03%) ⬆️
Linux_4 29.00% <ø> (+<0.01%) ⬆️
Windows_1 29.06% <96.77%> (+0.03%) ⬆️
Windows_2 56.34% <ø> (-0.01%) ⬇️
Windows_3 37.90% <ø> (+0.03%) ⬆️
Windows_4 29.00% <ø> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
kavilla
kavilla previously approved these changes Nov 20, 2024
SuZhou-Joe
SuZhou-Joe previously approved these changes Nov 28, 2024
SuZhou-Joe
SuZhou-Joe previously approved these changes Nov 29, 2024
Hailong-am
Hailong-am previously approved these changes Dec 2, 2024
Signed-off-by: yubonluo <[email protected]>
@yubonluo yubonluo dismissed stale reviews from Hailong-am and SuZhou-Joe via 10cef9e December 2, 2024 06:15
@Hailong-am Hailong-am merged commit b31206a into opensearch-project:main Dec 2, 2024
69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 2, 2024
…et (#8888)

* Isolate objects based on workspace when calling get/bulkGet

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

* Changeset file for PR #8888 created/updated

* add integration tests

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

* optimize the code

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

* optimize the code

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

* optimize the code

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

* optimize the function name

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

* add data source validate

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

* optimize the code

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

---------

Signed-off-by: yubonluo <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit b31206a)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Dec 3, 2024
…et (#8888) (#8990)

* Isolate objects based on workspace when calling get/bulkGet



* Changeset file for PR #8888 created/updated

* add integration tests



* optimize the code



* optimize the code



* optimize the code



* optimize the function name



* add data source validate



* optimize the code



---------



(cherry picked from commit b31206a)

Signed-off-by: yubonluo <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.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