8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-09-17 11:43:08 +00:00

Merge branch 'fix_247' into 'dev'

Fix 247

See merge request re2o/re2o!497
This commit is contained in:
Jean-Romain Garnier 2020-04-18 02:01:16 +02:00
commit 614538eefe

View file

@ -1394,14 +1394,15 @@ class Adherent(User):
:return: a message and a boolean which is True if the user can create :return: a message and a boolean which is True if the user can create
a user or if the `options.all_can_create` is set. a user or if the `options.all_can_create` is set.
""" """
if not user_request.is_authenticated and not OptionalUser.get_cached_value( if not user_request.is_authenticated:
if not OptionalUser.get_cached_value(
"self_adhesion" "self_adhesion"
): ):
return False, _("Self registration is disabled."), None return False, _("Self registration is disabled."), None
else: else:
if OptionalUser.get_cached_value( return True, None, None
"all_can_create_adherent" else:
) or OptionalUser.get_cached_value("self_adhesion"): if OptionalUser.get_cached_value("all_can_create_adherent"):
return True, None, None return True, None, None
else: else:
can = user_request.has_perm("users.add_user") can = user_request.has_perm("users.add_user")