From 06b38b823176ce29ef22b49aa2746c730728bca3 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 29 Jul 2021 17:10:52 +0200 Subject: [PATCH] [auth_ldap] modify_role has to be called before the update to change it on the backend --- flaschengeist/plugins/auth_ldap/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flaschengeist/plugins/auth_ldap/__init__.py b/flaschengeist/plugins/auth_ldap/__init__.py index 32799e4..627325a 100644 --- a/flaschengeist/plugins/auth_ldap/__init__.py +++ b/flaschengeist/plugins/auth_ldap/__init__.py @@ -10,7 +10,7 @@ from ldap3 import SUBTREE, MODIFY_REPLACE, MODIFY_ADD, MODIFY_DELETE from werkzeug.exceptions import BadRequest, InternalServerError, NotFound from flaschengeist import logger -from flaschengeist.plugins import AuthPlugin, after_role_updated +from flaschengeist.plugins import AuthPlugin, before_role_updated from flaschengeist.models.user import User, Role, _Avatar import flaschengeist.controller.userController as userController @@ -47,8 +47,9 @@ class AuthLDAP(AuthPlugin): self.root_dn = config.get("root_dn", None) self.root_secret = config.get("root_secret", None) - @after_role_updated + @before_role_updated def _role_updated(role, new_name): + logger.debug(f"LDAP: before_role_updated called with ({role}, {new_name})") self.__modify_role(role, new_name) def login(self, user, password):