Skip to content

fix(auth): initialize bootstrap admin as employee - #37

Merged
bbbbbbbbbbbbba merged 1 commit into
huabeitech:mainfrom
higenglele:fix/gh-36/bootstrap-admin-user-type
Sep 9, 2026
Merged

bbbbbbbbbbbbba merged 1 commit into
huabeitech:mainfrom
higenglele:fix/gh-36/bootstrap-admin-user-type

Conversation

@higenglele

Copy link
Copy Markdown
Contributor

The bootstrap admin receives the super_admin role but inherits user_type=user, so dashboard authentication rejects it. Initialize it as employee and add migration 10 to repair existing installations where migration 2 has already succeeded.

The repair only updates the active, non-deleted default admin with an active super_admin role and user_type=user. It preserves passwords, account status and role assignments, and is idempotent. This uses the existing enums and migration framework.

Fixes #36.

Validation:

  • Reproduced the incorrect bootstrap type with a failing regression test before applying the fix.
  • Passed bootstrap creation and repair tests, including ordinary users, missing roles, disabled/deleted accounts and repeated execution.
  • Passed the existing backend CI test suite plus ./internal/migration/... with Go 1.26 and -tags dev.
  • Ran gofmt and git diff --check.

The migration regression tests use SQLite. A MySQL integration run was not performed.

Set the bootstrap account type explicitly so dashboard authentication accepts it. Add an idempotent migration for existing active bootstrap super admins and cover the repair boundaries in CI.
@bbbbbbbbbbbbba
bbbbbbbbbbbbba merged commit 46c8f6c into huabeitech:main Sep 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Bootstrap admin defaults to user type and is denied dashboard operations

2 participants