scim: Upgrade to django-scim2 0.17.1.

The new release adds the commit:
20ac22b96d

Which allows us to get rid of the entire ugly override that was needed
to do this commit's job in our code. What we do here in this commit:
* Use django-scim2 0.17.1
* Revert the relevant parts of f5a65846a8
* Adjust the expected error message in test_exception_details_not_revealed_to_client
  since the message thrown by django-scim2 in this release is slightly
  different.

We do not have to add anything to set EXPOSE_SCIM_EXCEPTIONS, since
django-scim2 uses False as the default, which is what we want - and we
have the aforementioned test verifying that indeed information doesn't
get revealed to the SCIM client.
This commit is contained in:
Mateusz Mandera
2022-02-04 19:57:11 +01:00
committed by Tim Abbott
parent 1045737be6
commit a1fa2a8cf5
6 changed files with 18 additions and 90 deletions

View File

@@ -754,45 +754,34 @@ urls += [path("saml/metadata.xml", saml_sp_metadata)]
# SCIM2
from zerver.lib.scim import (
ZulipSCIMSearchView,
ZulipSCIMUserSearchView,
ZulipSCIMUsersView,
ZulipSCIMView,
)
from django_scim import views as scim_views
urls += [
# We have to register all the SCIM URL patterns first, because we override
# all the SCIM View classes and we need Django to use them instead of
# the django-scim2 Views that the app will register.
re_path(r"^scim/v2/$", ZulipSCIMView.as_view(implemented=False)),
re_path(r"^scim/v2/.search$", ZulipSCIMSearchView.as_view(implemented=False)),
re_path(r"^scim/v2/Users/.search$", ZulipSCIMUserSearchView.as_view()),
re_path(r"^scim/v2/Users(?:/(?P<uuid>[^/]+))?$", ZulipSCIMUsersView.as_view()),
# Everything below here are features that we don't yet support and we want
# to explicitly mark them to return "Not Implemented" rather than running
# the django-scim2 code for them.
re_path(
r"^scim/v2/Groups/.search$",
ZulipSCIMView.as_view(implemented=False),
scim_views.SCIMView.as_view(implemented=False),
),
re_path(
r"^scim/v2/Groups(?:/(?P<uuid>[^/]+))?$",
ZulipSCIMView.as_view(implemented=False),
scim_views.SCIMView.as_view(implemented=False),
),
re_path(r"^scim/v2/Me$", ZulipSCIMView.as_view(implemented=False)),
re_path(r"^scim/v2/Me$", scim_views.SCIMView.as_view(implemented=False)),
re_path(
r"^scim/v2/ServiceProviderConfig$",
ZulipSCIMView.as_view(implemented=False),
scim_views.SCIMView.as_view(implemented=False),
),
re_path(
r"^scim/v2/ResourceTypes(?:/(?P<uuid>[^/]+))?$",
ZulipSCIMView.as_view(implemented=False),
scim_views.SCIMView.as_view(implemented=False),
),
re_path(r"^scim/v2/Schemas(?:/(?P<uuid>[^/]+))?$", ZulipSCIMView.as_view(implemented=False)),
re_path(r"^scim/v2/Bulk$", ZulipSCIMView.as_view(implemented=False)),
# At the end we still register the django-scim2 url patterns (even though we override them all above)
# so that reverse("scim:viewname") still works like the internal library code expects.
re_path(
r"^scim/v2/Schemas(?:/(?P<uuid>[^/]+))?$", scim_views.SCIMView.as_view(implemented=False)
),
re_path(r"^scim/v2/Bulk$", scim_views.SCIMView.as_view(implemented=False)),
# This registers the remaining SCIM endpoints.
path("scim/v2/", include("django_scim.urls", namespace="scim")),
]