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

Fix tenant label for custom tenant when both Global and Private tenan… #1277

Merged
merged 3 commits into from
Dec 22, 2022

Conversation

RyanL1997
Copy link
Collaborator

@RyanL1997 RyanL1997 commented Dec 20, 2022

Signed-off-by: Ryan Liang [email protected]

Description

Fix tenant label for custom tenant when both Global and Private tenants are disabled

Category

Bug fix

Issues Resolved

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@RyanL1997 RyanL1997 requested a review from a team December 20, 2022 18:06
Copy link
Member

@cwperks cwperks left a comment

Choose a reason for hiding this comment

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

Thank you @RyanL1997! The change looks good to me, but I'd like to see a test to verify the change.

server/multitenancy/tenant_resolver.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #1277 (56dd695) into main (7ffbf09) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1277   +/-   ##
=======================================
  Coverage   71.78%   71.78%           
=======================================
  Files          88       88           
  Lines        2027     2027           
  Branches      269      274    +5     
=======================================
  Hits         1455     1455           
  Misses        509      509           
  Partials       63       63           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Object.keys(availableTenantsClone).length > 1 &&
availableTenantsClone.hasOwnProperty(globalTenantName)
) {
delete availableTenantsClone[globalTenantName];
Copy link
Member

Choose a reason for hiding this comment

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

This will work, but it's a bit confusing why global_tenant is in this data structure in the first place. I went over to the security plugin to find where its coming from and it looks like its being added here: https://github.com/opensearch-project/security/blob/main/src/main/java/org/opensearch/security/securityconf/ConfigModelV7.java#L1135-L1140

I'm finding that block hard to follow and not sure what the reason for it is.

This PR looks good to me overall. I will approve when the test descriptions are updated.

Copy link
Collaborator Author

@RyanL1997 RyanL1997 Dec 21, 2022

Choose a reason for hiding this comment

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

I think this global_tenant is basically functioning as the 'Global' tenant. Just for the case that user doesn't have any custom tenants with multi-tenancy enabled but disable both 'Global' and 'Private' tenants.

Referencing to the information from @cliu123, I also left a comment in the original issue: #1248 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

@cwperks Yes, global_tenant comes from there.
@RyanL1997 You're right. global_tenant is global tenant.

Signed-off-by: Ryan Liang <[email protected]>
@cliu123
Copy link
Member

cliu123 commented Dec 21, 2022

LGTM!

@cwperks cwperks added the backport 2.x backport to 2.x branch label Dec 22, 2022
@cwperks cwperks merged commit 1cffd90 into opensearch-project:main Dec 22, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 22, 2022
#1277)

* Fix tenant label for custom tenant when both Global and Private tenants are disabled

Signed-off-by: Ryan Liang <[email protected]>
(cherry picked from commit 1cffd90)
cwperks pushed a commit that referenced this pull request Dec 22, 2022
#1277) (#1280)

* Fix tenant label for custom tenant when both Global and Private tenants are disabled

Signed-off-by: Ryan Liang <[email protected]>
(cherry picked from commit 1cffd90)

Co-authored-by: Ryan Liang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Dashboard login problem - global_tenant getting displayed in custom tenants if Global tenant is disabled
4 participants