|
@@ -1,6 +1,6 @@
|
|
|
from __future__ import annotations
|
|
|
|
|
|
-from typing import Any, Dict, Union
|
|
|
+from typing import Any, Dict, List, Union
|
|
|
|
|
|
import sentry_sdk
|
|
|
from django.conf import settings
|
|
@@ -12,6 +12,7 @@ from rest_framework.exceptions import PermissionDenied, ValidationError
|
|
|
from rest_framework.fields import Field
|
|
|
from rest_framework.request import Request
|
|
|
from rest_framework.response import Response
|
|
|
+from typing_extensions import TypedDict
|
|
|
|
|
|
from sentry import audit_log, roles
|
|
|
from sentry.api.base import control_silo_endpoint
|
|
@@ -32,6 +33,7 @@ from sentry.apidocs.constants import (
|
|
|
)
|
|
|
from sentry.apidocs.examples.scim_examples import SCIMExamples
|
|
|
from sentry.apidocs.parameters import GlobalParams, SCIMParams
|
|
|
+from sentry.apidocs.utils import inline_sentry_response_serializer
|
|
|
from sentry.auth.providers.saml2.activedirectory.apps import ACTIVE_DIRECTORY_PROVIDER_NAME
|
|
|
from sentry.models import AuthIdentity, AuthProvider, InviteStatus, OrganizationMember
|
|
|
from sentry.roles import organization_roles
|
|
@@ -52,7 +54,6 @@ from .utils import (
|
|
|
SCIMApiError,
|
|
|
SCIMEndpoint,
|
|
|
SCIMQueryParamSerializer,
|
|
|
- scim_response_envelope,
|
|
|
)
|
|
|
|
|
|
ERR_ONLY_OWNER = "You cannot remove the only remaining owner of the organization."
|
|
@@ -358,6 +359,14 @@ class OrganizationSCIMMemberDetails(SCIMEndpoint, OrganizationMemberEndpoint):
|
|
|
return Response(context, status=200)
|
|
|
|
|
|
|
|
|
+class SCIMListResponseDict(TypedDict):
|
|
|
+ schemas: List[str]
|
|
|
+ totalResults: int
|
|
|
+ startIndex: int
|
|
|
+ itemsPerPage: int
|
|
|
+ Resources: List[OrganizationMemberSCIMSerializerResponse]
|
|
|
+
|
|
|
+
|
|
|
@control_silo_endpoint
|
|
|
class OrganizationSCIMMemberIndex(SCIMEndpoint):
|
|
|
permission_classes = (OrganizationSCIMMemberPermission,)
|
|
@@ -368,8 +377,8 @@ class OrganizationSCIMMemberIndex(SCIMEndpoint):
|
|
|
parameters=[GlobalParams.ORG_SLUG, SCIMQueryParamSerializer],
|
|
|
request=None,
|
|
|
responses={
|
|
|
- 200: scim_response_envelope(
|
|
|
- "SCIMMemberIndexResponse", OrganizationMemberSCIMSerializerResponse
|
|
|
+ 200: inline_sentry_response_serializer(
|
|
|
+ "SCIMListResponseEnvelopeSCIMMemberIndexResponse", SCIMListResponseDict
|
|
|
),
|
|
|
401: RESPONSE_UNAUTHORIZED,
|
|
|
403: RESPONSE_FORBIDDEN,
|