forked from ScoDoc/ScoDoc
CAS: corrige formulaire config utilisateur (bug PB)
This commit is contained in:
parent
a7ada3a1d5
commit
7da076c1bf
@ -69,7 +69,7 @@ class User(UserMixin, db.Model):
|
||||
)
|
||||
"Peut-on se logguer via le CAS ?"
|
||||
cas_allow_scodoc_login = db.Column(
|
||||
db.Boolean, default=True, server_default="false", nullable=False
|
||||
db.Boolean, default=False, server_default="false", nullable=False
|
||||
)
|
||||
"""(not yet implemented XXX)
|
||||
si CAS activé, peut-on se logguer sur ScoDoc directement ?
|
||||
@ -221,7 +221,7 @@ class User(UserMixin, db.Model):
|
||||
data["email"] = self.email or ""
|
||||
return data
|
||||
|
||||
def from_dict(self, data, new_user=False):
|
||||
def from_dict(self, data: dict, new_user=False):
|
||||
"""Set users' attributes from given dict values.
|
||||
Roles must be encoded as "roles_string", like "Ens_RT, Secr_CJ"
|
||||
"""
|
||||
@ -233,11 +233,16 @@ class User(UserMixin, db.Model):
|
||||
"email",
|
||||
"date_expiration",
|
||||
"cas_id",
|
||||
"cas_allow_login",
|
||||
"cas_allow_scodoc_login",
|
||||
]:
|
||||
if field in data:
|
||||
setattr(self, field, data[field] or None)
|
||||
# required boolean fields
|
||||
for field in [
|
||||
"cas_allow_login",
|
||||
"cas_allow_scodoc_login",
|
||||
]:
|
||||
setattr(self, field, data.get(field, False))
|
||||
|
||||
if new_user:
|
||||
if "user_name" in data:
|
||||
# never change name of existing users
|
||||
|
@ -800,7 +800,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
|
||||
elif input_type in ("radio", "menu", "checkbox", "boolcheckbox"):
|
||||
if input_type == "boolcheckbox":
|
||||
labels = descr.get(
|
||||
"labels", descr.get("allowed_values", ["oui", "non"])
|
||||
"labels", descr.get("allowed_values", ["non", "oui"])
|
||||
)
|
||||
_val = self.values[field]
|
||||
if isinstance(_val, bool):
|
||||
|
Loading…
Reference in New Issue
Block a user