-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(control_silo): Move Identitiy model to users module #76272
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
ref(control_silo): Move Identitiy model to users module #76272
Conversation
src/sentry/users/models/identity.py
Outdated
def get_provider(self) -> Identity: | ||
from sentry.identity import get | ||
|
||
return get(self.type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I interpreted the get()
function returning a cls("Identity")
which would just be an Identity class... (???)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be IdentityProvider
. The get()
will return an instance of the registered types (Providers) based on the string name provided.
Providers are registered here
sentry/src/sentry/identity/__init__.py
Lines 25 to 34 in 4fb67fb
register(SlackIdentityProvider) # NOQA | |
register(GitHubIdentityProvider) # NOQA | |
register(GitHubEnterpriseIdentityProvider) # NOQA | |
register(VSTSIdentityProvider) # NOQA | |
register(VstsExtensionIdentityProvider) # NOQA | |
register(VercelIdentityProvider) # NOQA | |
register(BitbucketIdentityProvider) # NOQA | |
register(GitlabIdentityProvider) # NOQA | |
register(GoogleIdentityProvider) # NOQA | |
register(DiscordIdentityProvider) # NOQA |
The Slack
provider is found
class SlackIdentityProvider(OAuth2Provider): |
and the class tree for those ends in Provider
sentry/src/sentry/identity/base.py
Line 7 in 6ef9112
class Provider(PipelineProvider, abc.ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhh, gotchas. I completely missed the whole provider registration and that the self.values
in IdentityManager
was populated with Providers from the registration. 🫠 Thank yous for the class by class explanation!
Part of moving control silo user related resources into the users module. Includes adding import shim for any getsentry refs. Also adds minor typing to some identity functions (will point out).
Apart of (#73856)