scim: Downgrade SCIMClient from a model to an ephemeral dataclass.

SCIMClient is a type-unsafe workaround for django-scim2’s conflation
of SCIM users with Django users.  Given that a SCIMClient is not a
UserProfile, it might as well not be a model at all, since it’s only
used to satisfy django-scim2’s request.user.is_authenticated queries.

This doesn’t solve the type safety issue with assigning a SCIMClient
to request.user, nor the performance issue with running the SCIM
middleware on non-SCIM requests.  But it reduces the risk of potential
consequences worse than crashing, since there’s no longer a
request.user.id for Django to confuse with the ID of an actual
UserProfile.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-09-23 23:33:11 -07:00
committed by Tim Abbott
parent 8fc811dfa9
commit 9198fe4fac
6 changed files with 47 additions and 50 deletions

View File

@@ -152,7 +152,6 @@ ALL_ZULIP_TABLES = {
"zerver_scheduledemail_users",
"zerver_scheduledmessage",
"zerver_scheduledmessagenotificationemail",
"zerver_scimclient",
"zerver_service",
"zerver_stream",
"zerver_submessage",
@@ -203,8 +202,6 @@ NON_EXPORTED_TABLES = {
"zerver_scheduledemail",
"zerver_scheduledemail_users",
"zerver_scheduledmessage",
# SCIMClient should be manually created for the new realm after importing.
"zerver_scimclient",
# These tables are related to a user's 2FA authentication
# configuration, which will need to be set up again on the new
# server.