|
@@ -41,6 +41,7 @@ from sentry.services.hybrid_cloud.organization import (
|
|
|
RpcOrganization,
|
|
|
RpcOrganizationMember,
|
|
|
RpcOrganizationMemberFlags,
|
|
|
+ RpcOrganizationMemberSummary,
|
|
|
organization_service,
|
|
|
)
|
|
|
from sentry.services.hybrid_cloud.organization.impl import DatabaseBackedOrganizationService
|
|
@@ -57,10 +58,7 @@ _SSO_NONMEMBER = RpcMemberSsoState(False, False)
|
|
|
# When OrgMemberMapping table is created for the control silo, org_member_class will use that rather
|
|
|
# than the OrganizationMember type.
|
|
|
def query_sso_state(
|
|
|
- organization_id: int | None,
|
|
|
- is_super_user: bool,
|
|
|
- member: RpcOrganizationMember | OrganizationMember | None,
|
|
|
- org_member_class: Any = OrganizationMember,
|
|
|
+ organization_id: int | None, is_super_user: bool, member: RpcOrganizationMemberSummary | None
|
|
|
) -> RpcMemberSsoState:
|
|
|
"""
|
|
|
Check whether SSO is required and valid for a given member.
|
|
@@ -106,7 +104,7 @@ def query_sso_state(
|
|
|
organization_id=org_id
|
|
|
)
|
|
|
return (
|
|
|
- org_member_class.objects.filter(
|
|
|
+ OrganizationMember.objects.filter(
|
|
|
Q(id__in=all_top_dogs_from_teams) | Q(role=roles.get_top_dog().id),
|
|
|
organization_id=org_id,
|
|
|
user__is_active=True,
|
|
@@ -233,13 +231,10 @@ class DatabaseBackedAuthService(AuthService):
|
|
|
user_id: int,
|
|
|
is_superuser: bool,
|
|
|
organization_id: int | None,
|
|
|
- org_member: RpcOrganizationMember | OrganizationMember | None,
|
|
|
+ org_member: RpcOrganizationMemberSummary | None,
|
|
|
) -> RpcAuthState:
|
|
|
sso_state = query_sso_state(
|
|
|
- organization_id=organization_id,
|
|
|
- is_super_user=is_superuser,
|
|
|
- member=org_member,
|
|
|
- org_member_class=OrganizationMember,
|
|
|
+ organization_id=organization_id, is_super_user=is_superuser, member=org_member
|
|
|
)
|
|
|
permissions: List[str] = list()
|
|
|
# "permissions" is a bit of a misnomer -- these are all admin level permissions, and the intent is that if you
|