From 34236abacf5699e36a52dc14ce4ca5f022c404d7 Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Thu, 7 Nov 2024 17:49:40 +0100 Subject: [PATCH] [FIX] auth_partner: Fix directory rights on token generation --- auth_partner/models/auth_directory.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auth_partner/models/auth_directory.py b/auth_partner/models/auth_directory.py index afe997ad..5a862ca0 100644 --- a/auth_partner/models/auth_directory.py +++ b/auth_partner/models/auth_directory.py @@ -147,6 +147,8 @@ def _send_mail_impl(self, type_or_template, auth_partner, **context): return f"Mail {template.name} sent to {auth_partner.login}" def _generate_token(self, action, auth_partner, expiration_delta, key_salt=""): + # We need to sudo here as secret_key is a protected field + self = self.sudo() return jwt.encode( { "exp": datetime.now(tz=timezone.utc) + expiration_delta,