do_set_realm_authentication_methods: Use transaction.atomic.

This commit is contained in:
Mateusz Mandera
2021-12-11 14:31:02 +01:00
committed by Tim Abbott
parent 21ab5e3a55
commit dc9aac9253

View File

@@ -873,6 +873,7 @@ def do_set_realm_authentication_methods(
realm: Realm, authentication_methods: Dict[str, bool], *, acting_user: Optional[UserProfile]
) -> None:
old_value = realm.authentication_methods_dict()
with transaction.atomic():
for key, value in list(authentication_methods.items()):
index = getattr(realm.authentication_methods, key).number
realm.authentication_methods.set_bit(index, int(value))
@@ -891,6 +892,7 @@ def do_set_realm_authentication_methods(
}
).decode(),
)
event = dict(
type="realm",
op="update_dict",