From 257248aa2b208781f5f6c791449d01ae8aade0ea Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 26 Aug 2022 14:05:25 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20=C3=A9dition=20des=20utilisateurs.=20#30?= =?UTF-8?q?5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/TrivialFormulator.py | 6 +- app/scodoc/sco_exceptions.py | 9 + app/scodoc/sco_permissions.py | 4 +- app/templates/auth/user_info_page.html | 24 +- app/views/users.py | 360 ++++++++++++++----------- 5 files changed, 229 insertions(+), 174 deletions(-) diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index ae7007683b..5b7020a8fe 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -730,11 +730,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts); R.append("%s" % title) R.append('' % klass) - if ( - input_type == "text" - or input_type == "text_suggest" - or input_type == "color" - ): + if input_type in ("text", "text_suggest", "color", "datedmy"): R.append(("%(" + field + ")s") % self.values) elif input_type in ("radio", "menu", "checkbox", "boolcheckbox"): if input_type == "boolcheckbox": diff --git a/app/scodoc/sco_exceptions.py b/app/scodoc/sco_exceptions.py index 2537509972..967b26f714 100644 --- a/app/scodoc/sco_exceptions.py +++ b/app/scodoc/sco_exceptions.py @@ -47,6 +47,15 @@ class ScoValueError(ScoException): self.dest_url = dest_url +class ScoPermissionDenied(ScoValueError): + """Permission non accordée (appli web)""" + + def __init__(self, msg=None, dest_url=None): + if msg is None: + msg = "Opération non autorisée !" + super().__init__(msg, dest_url=dest_url) + + class ScoBugCatcher(ScoException): "bug avec enquete en cours" diff --git a/app/scodoc/sco_permissions.py b/app/scodoc/sco_permissions.py index 5e1bd8c4dd..07d606e878 100644 --- a/app/scodoc/sco_permissions.py +++ b/app/scodoc/sco_permissions.py @@ -15,8 +15,8 @@ _SCO_PERMISSIONS = ( (1 << 2, "ScoView", "Voir"), (1 << 3, "ScoEnsView", "Voir les parties pour les enseignants"), (1 << 4, "ScoObservateur", "Observer (accès lecture restreint aux bulletins)"), - (1 << 5, "ScoUsersAdmin", "Gérer les utilisateurs"), - (1 << 6, "ScoUsersView", "Voir les utilisateurs"), + (1 << 5, "ScoUsersAdmin", "Gérer les utilisateurs (de son département)"), + (1 << 6, "ScoUsersView", "Voir les utilisateurs (de tous les dépts)"), (1 << 7, "ScoChangePreferences", "Modifier les préférences"), (1 << 8, "ScoChangeFormation", "Changer les formations"), (1 << 9, "ScoEditFormationTags", "Tagguer les formations"), diff --git a/app/templates/auth/user_info_page.html b/app/templates/auth/user_info_page.html index f344fb1153..1c2223294f 100644 --- a/app/templates/auth/user_info_page.html +++ b/app/templates/auth/user_info_page.html @@ -18,23 +18,33 @@ {{user.date_expiration.isoformat() if user.date_expiration else "(sans limite)"}}

{% if current_user.id == user.id %} @@ -45,7 +55,7 @@ {# Liste des permissions #}
-

Permissions de cet utilisateur dans le département {{dept}}:

+

Permissions de cet utilisateur dans le département {{dept}}: