settings_data: Optimize user_can_access_all_other_users.

This fixes an important issue where this function being called in a
loop can consume as much as 1ms per iteration for users who are in a
lot of groups.
This commit is contained in:
Tim Abbott
2025-05-29 13:01:03 -07:00
parent 0ec07fe4c8
commit 446ba1b538
3 changed files with 14 additions and 0 deletions

View File

@@ -730,6 +730,8 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
allow_nobody_group=False,
allow_everyone_group=True,
default_group_name=SystemGroups.EVERYONE,
# Note that user_can_access_all_other_users in the web
# app is relying on members always have access.
allowed_system_groups=[SystemGroups.EVERYONE, SystemGroups.MEMBERS],
),
can_add_subscribers_group=GroupPermissionSetting(