Sync user permissions to the new type on OIDC group mapping

A user promoted via the group claim had its type changed but kept the
permissions of its previous type (e.g. a new user mapped to admin could
not upload). Update permissions from the new type's defaults when the
type changes, and cover it in the setUserGroup tests.
This commit is contained in:
Boris Rybalkin 2026-06-06 23:57:56 +01:00
parent d6cfdd3bec
commit e8b845e43c
2 changed files with 7 additions and 0 deletions

View file

@ -212,6 +212,7 @@ class OidcAuthStrategy {
if (user.type !== userType) {
Logger.info(`[OidcAuth] openid callback: Updating user "${user.username}" type to "${userType}" from "${user.type}"`)
user.type = userType
user.permissions = Database.userModel.getDefaultPermissionsForUserType(userType)
await user.save()
}
} else {