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

[#346] Fix configs to support multi-tenancy #359

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

roberlander2
Copy link
Collaborator

Description

This PR replaces the client_id field with an app_id field and an org_id field in all data models and existing database documents to support multi-tenancy. It also makes changes to the configs collection by merging it with the managed_group_configs collection and adding the model.Config wrapper around existing config models to better handle multi-tenancy.
Depends on rokwire/core-auth-library-go#86

Resolves #346
Resolves #224

Review Time Estimate

Please give your idea of how soon this pull request needs to be reviewed by selecting one of the options below. This can be based on the criticality of the issue at hand and/or other relevant factors.

  • Immediately
  • Within a week
  • When possible

Type of changes

Please select a relevant option:

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Other (any another change that does not fall in one of the above categories.)

Checklist:

Please select all applicable options:

  • I have signed the Rokwire Contributor License Agreement (CLA). (Any contributor who is not an employee of the University of Illinois whose official duties include contributing to the Rokwire software, or who is not paid by the Rokwire project, needs to sign the CLA before their contribution can be accepted.)
  • I have updated the CHANGELOG.
  • I have read the Contributor Guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My change requires updating the documentation.
  • I have made necessary changes to the documentation.
  • I have added tests related to my changes.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

@roberlander2 roberlander2 requested a review from shurwit February 21, 2023 18:02
@roberlander2 roberlander2 linked an issue Feb 21, 2023 that may be closed by this pull request
Copy link
Collaborator

@mdryankov mdryankov left a comment

Choose a reason for hiding this comment

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

Hi @shurwit & @roberlander2,

I'm getting compile issues:
Build Error: go build -o /Users/mladen/Projects/groups-building-block/__debug_bin -gcflags all=-N -l .

groups/core

core/administration.go:50:15: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess)
core/administration.go:66:20: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess)
core/administration.go:79:16: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess)
core/administration.go:111:15: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess)
core/administration.go:136:15: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess) (exit status 1)

Also my understanding was that I could mainly comment and I have to wait for an explicit conformation by @shurwit before do any significiant review on my side. It looks that's not the case.

Dockerfile Outdated
@@ -1,4 +1,4 @@
FROM golang:1.19-bullseye as builder
FROM golang:1.20.1-buster as builder
Copy link
Collaborator

@mdryankov mdryankov Feb 22, 2023

Choose a reason for hiding this comment

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

Minor version is not a good approach, because it obligates to upgrade version periodiaclly. When it's omittied it means to use the latest minor version during the build time.

I think it's better to use bullseye, unless there is a reason to use buster which I dont see.

What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for catching this @mdryankov, I will remove the minor version and make the change to bullseye. If I understand correctly, the reason to use bullseye over buster is because bullseye is the codename for the latest stable Debian release, so the buster release is now old.

Please let me know if I am missing anything with this explanation. Thanks!

Comment on lines -363 to +359
err = json.Unmarshal(data, &requestData)
err := json.NewDecoder(r.Body).Decode(&requestData)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Beautiful!

@roberlander2
Copy link
Collaborator Author

Hi @shurwit & @roberlander2,

I'm getting compile issues: Build Error: go build -o /Users/mladen/Projects/groups-building-block/__debug_bin -gcflags all=-N -l .

groups/core

core/administration.go:50:15: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess) core/administration.go:66:20: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess) core/administration.go:79:16: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess) core/administration.go:111:15: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess) core/administration.go:136:15: claims.CanAccess undefined (type *tokenauth.Claims has no field or method CanAccess) (exit status 1)

Also my understanding was that I could mainly comment and I have to wait for an explicit conformation by @shurwit before do any significiant review on my side. It looks that's not the case.

Thanks @mdryankov, these compile issues are due to this PR's dependence on rokwire/core-auth-library-go#86, which has not been added to a new version of the auth library yet. We plan to make this new release version soon. I will let you know when the new release has been integrated into this PR.

@mdryankov
Copy link
Collaborator

mdryankov commented Mar 15, 2023

Let me know expplicitly when this one is good to go. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Fix configs to support multi-tenancy [BUG] Fix multi-tenancy
2 participants