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: accomplish dashboard_admin #95

Merged
merged 3 commits into from
Aug 22, 2023

Conversation

SuZhou-Joe
Copy link
Collaborator

@SuZhou-Joe SuZhou-Joe commented Aug 21, 2023

Description

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

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2023

Codecov Report

Merging #95 (99d936e) into workspace (b49aa1f) will increase coverage by 0.00%.
Report is 6 commits behind head on workspace.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           workspace      #95   +/-   ##
==========================================
  Coverage      65.78%   65.78%           
==========================================
  Files           3334     3334           
  Lines          64441    64404   -37     
  Branches       10258    10248   -10     
==========================================
- Hits           42390    42370   -20     
+ Misses         19482    19463   -19     
- Partials        2569     2571    +2     
Flag Coverage Δ
Linux_1 34.73% <ø> (+0.02%) ⬆️
Linux_3 42.69% <ø> (+0.03%) ⬆️
Windows_1 ?
Windows_2 54.74% <ø> (+0.06%) ⬆️
Windows_3 ?
Windows_4 34.79% <ø> (+0.02%) ⬆️

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

see 12 files with indirect coverage changes

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

@SuZhou-Joe SuZhou-Joe merged commit 866e122 into ruanyl:workspace Aug 22, 2023
44 of 47 checks passed
@@ -140,6 +144,14 @@ export class WorkspaceSavedObjectsClientWrapper {
}
}

private isDashboardAdmin(request: OpenSearchDashboardsRequest): boolean {
const config = this.config || ({} as ConfigSchema);
Copy link
Owner

Choose a reason for hiding this comment

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

Looking at this piece of code, it seems there is a possibility that when isDashboardAdmin is called, but this.config hasn't initialized, in that case, isDashboardAdmin will return false which causes the client wrapper to return incorrect client functions if the current user is admin. Correct me if I'm wrong :)

Copy link
Owner

Choose a reason for hiding this comment

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

I figured it out, the isDashboardAdmin check is run on each request, then I think it will be fine.

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, the wrapper will be called in every request(though I think it is a waste of computing capability) so we can return back the right saved objects client according to backend roles of current requesting user.

SuZhou-Joe added a commit that referenced this pull request Aug 31, 2023
* feat: accomplish dashboard_admin

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

* feat: add yml default config and comment

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

* feat: update

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

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
SuZhou-Joe added a commit that referenced this pull request Aug 31, 2023
* feat: accomplish dashboard_admin

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

* feat: add yml default config and comment

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

* feat: update

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

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
ruanyl pushed a commit that referenced this pull request Sep 15, 2023
* feat: accomplish dashboard_admin

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

* feat: add yml default config and comment

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

* feat: update

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

---------

Signed-off-by: SuZhou-Joe <suzhou@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.

4 participants