Skip to content

Commit 8ca7ff5

Browse files
committed
Pass promo only if exists and >=2014
1 parent 7ae54d9 commit 8ca7ff5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/utils/auth/providers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,18 @@ def get_userinfo(self, user: models_users.CoreUser) -> dict[str, Any]:
173173

174174
# For Piwigo, providing the username is sufficient. The name of the claim (here `"name"`) needs to be set in Piwigo oidc plugin configuration page.
175175
# A modified Piwigo oidc plugin allows managing groups from the oidc provider
176+
promo = user.promo
177+
if promo is not None:
178+
if promo >= 2014:
179+
promo = str(promo)
180+
else:
181+
promo = None
176182
return {
177183
"sub": user.id,
178184
"name": user.full_name,
179185
"groups": [group.name for group in user.groups]
180186
+ [user.account_type.value]
181-
+ [str(user.promo)],
187+
+ [promo],
182188
"email": user.email,
183189
}
184190

0 commit comments

Comments
 (0)