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

feat: add workspace into includeHiddenTypes #249

Merged

Conversation

SuZhou-Joe
Copy link
Collaborator

@SuZhou-Joe SuZhou-Joe commented Feb 26, 2024

Description

Regarding PR opensearch-project#5075, we will make workspace as a hidden type so that it won't be modified by normal saved objects client. So that we'd have to include workspace as hidden types of saved objects wrapper and saved objects permission control service.

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

…mission control client

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
@SuZhou-Joe SuZhou-Joe changed the title feat: add workspace into includeHiddenTypes of client wrapper and per… feat: add workspace into includeHiddenTypes Feb 26, 2024
new SavedObjectsClient(repositoryFactory.createInternalRepository(includedHiddenTypes))
new SavedObjectsClient(
repositoryFactory.createInternalRepository([
...new Set([WORKSPACE_TYPE, ...(includedHiddenTypes || [])]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this a little bit strange? We can't exclude workspace type anymore, if we don't want to include this type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, let me refactor this part, create new client inside the wrapper.

@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.60%. Comparing base (fe9a4c1) to head (c2e9435).

Additional details and impacted files
@@            Coverage Diff             @@
##           workspace     #249   +/-   ##
==========================================
  Coverage      55.60%   55.60%           
==========================================
  Files           2260     2260           
  Lines          42470    42470           
  Branches        7539     7539           
==========================================
  Hits           23616    23616           
  Misses         17394    17394           
  Partials        1460     1460           
Flag Coverage Δ
Linux_2 55.17% <ø> (ø)
Linux_4 34.84% <ø> (ø)

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: SuZhou-Joe <suzhou@amazon.com>
Copy link
Collaborator

@wanglam wanglam left a comment

Choose a reason for hiding this comment

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

LGTM

@SuZhou-Joe SuZhou-Joe merged commit 0e2c02b into ruanyl:workspace Feb 27, 2024
27 of 34 checks passed
wanglam added a commit that referenced this pull request Mar 6, 2024
…objects client wrapper (#230)

* feat: add basic workspace saved objects client wrapper

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: add unit test (#2)

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

* feat: update client wrapper

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

* feat: init permission control in workspace plugin

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Support disable permission check on workspace (#228)

* support disable permission check for workspace

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* fix typos

Signed-off-by: Hailong Cui <ihailong@amazon.com>

---------

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* feat: add ACLSearchParams consumer in repository (#3)

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

* fix: ACLSearchParams missing in search dsl

Signed-off-by: Lin Wang <wonglam@amazon.com>

* test: add integration test for workspace saved objects client wrapper

Signed-off-by: Lin Wang <wonglam@amazon.com>

* style: add empty line under license

Signed-off-by: Lin Wang <wonglam@amazon.com>

* test: enable workspace permission control for integration tests

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: add workspace into includeHiddenTypes (#249)

* feat: add workspace into includeHiddenTypes of client wrapper and permission control client

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

* fix: hiddenType side effect

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

---------

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

* fix workspace client wrapper integration tests

Signed-off-by: Lin Wang <wonglam@amazon.com>

* add permissions fields to workspace CRUD APIs

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Move WorkspacePermissionMode inside workspace plugin

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Address pr comments

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove ACLSearchParams in public SavedObjectsFindOptions

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove lodash and Add default permissionModes

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: address concerns on ensureRawRequest (#4)

* feat: address concerns on ensureRawRequest

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

* feat: add check for empty array

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

* feat: make find api backward compatible

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

* feat: remove useless code

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

---------

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

* Update annotations and  error

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add unit tests for worksapce saved objects client wrapper

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove getPrincipalsOfObjects in permission

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix permissionEnabled flag missed in workspace plugin setup test

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Change back to Not Authorized error

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix unit tests for query_params and plugin setup

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix unittests in workspace server utils

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: add workspacesSearchOperators to decouple ACLSearchParams

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

* feat: update test cases

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

* feat: optimize test cases

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

* feat: optimize comment

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

* feat: omit defaultSearchOperator in public savedobjetcs client

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

* feat: omit workspacesSearchOperator field

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

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: Hailong Cui <ihailong@amazon.com>
Co-authored-by: Lin Wang <wonglam@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: Hailong Cui <ihailong@amazon.com>
SuZhou-Joe added a commit that referenced this pull request Mar 18, 2024
…objects client wrapper (#230)

* feat: add basic workspace saved objects client wrapper

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: add unit test (#2)

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

* feat: update client wrapper

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

* feat: init permission control in workspace plugin

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Support disable permission check on workspace (#228)

* support disable permission check for workspace

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* fix typos

Signed-off-by: Hailong Cui <ihailong@amazon.com>

---------

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* feat: add ACLSearchParams consumer in repository (#3)

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

* fix: ACLSearchParams missing in search dsl

Signed-off-by: Lin Wang <wonglam@amazon.com>

* test: add integration test for workspace saved objects client wrapper

Signed-off-by: Lin Wang <wonglam@amazon.com>

* style: add empty line under license

Signed-off-by: Lin Wang <wonglam@amazon.com>

* test: enable workspace permission control for integration tests

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: add workspace into includeHiddenTypes (#249)

* feat: add workspace into includeHiddenTypes of client wrapper and permission control client

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

* fix: hiddenType side effect

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

---------

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

* fix workspace client wrapper integration tests

Signed-off-by: Lin Wang <wonglam@amazon.com>

* add permissions fields to workspace CRUD APIs

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Move WorkspacePermissionMode inside workspace plugin

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Address pr comments

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove ACLSearchParams in public SavedObjectsFindOptions

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove lodash and Add default permissionModes

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: address concerns on ensureRawRequest (#4)

* feat: address concerns on ensureRawRequest

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

* feat: add check for empty array

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

* feat: make find api backward compatible

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

* feat: remove useless code

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

---------

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

* Update annotations and  error

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add unit tests for worksapce saved objects client wrapper

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove getPrincipalsOfObjects in permission

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix permissionEnabled flag missed in workspace plugin setup test

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Change back to Not Authorized error

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix unit tests for query_params and plugin setup

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix unittests in workspace server utils

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: add workspacesSearchOperators to decouple ACLSearchParams

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

* feat: update test cases

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

* feat: optimize test cases

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

* feat: optimize comment

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

* feat: omit defaultSearchOperator in public savedobjetcs client

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

* feat: omit workspacesSearchOperator field

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

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: Hailong Cui <ihailong@amazon.com>
Co-authored-by: Lin Wang <wonglam@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: Hailong Cui <ihailong@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.

3 participants