diff --git a/app/views/users.py b/app/views/users.py index 6bf16f4dcd..3d07b05a3f 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -594,8 +594,14 @@ def create_user_form(user_name=None, edit=0, all_roles=True): roles = set(vals["roles"]).intersection(editable_roles_strings) if not current_user.is_administrator(): # empeche modification des paramètres CAS - vals.pop("cas_allow_login", None) - vals.pop("cas_allow_scodoc_login", None) + if "cas_allow_login" in vals: + vals["cas_allow_login"] = cas_allow_login_default + if "cas_allow_scodoc_login" in vals: + if the_user is None: + vals.pop("cas_allow_scodoc_login", None) + else: + vals["cas_allow_scodoc_login"] = the_user.cas_allow_scodoc_login + if not current_user.has_permission(Permission.UsersChangeCASId): vals.pop("cas_id", None) if "edit" in vals: