FEATURE GAP: OIDC login does not assign admin role to the first user, blocking template seeding #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while fixing #1.
seedPrebuiltTemplates()requires an admin user to exist before it will seed the pre-builttemplates. Local registration assigns the
adminrole to the first user(authController.js:34-45), but the OIDC user-creation path does not:
https://forge.routemehome.org/brian/get_healthy/src/commit/main/backend/src/utils/passport-config.js#L47-L58
findOrCreateUser()inbackend/src/utils/passport-config.jscreates new users without setting arole, so the user gets the schema default (user). If the first account on an instance iscreated via OIDC login instead of local registration:
surgery to recover
Suggested fix
Mirror the local-registration logic in
findOrCreateUser(): count existing users and assignrole: 'admin'when creating the first one (and triggerseedPrebuiltTemplates()afterward,matching the behavior added in authController.register).
Notes
was deleted) — possibly out of scope, but worth a thought while in this code path.
FEATUR GAP: OIDC login does not assign admin role to the first user, blocking template seedingto FEATURE GAP: OIDC login does not assign admin role to the first user, blocking template seeding