Roles: add a system admin and lock down the user and API-key endpoints #3
Reference in New Issue
Block a user
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?
Part of #1. Depends on the Postgres move.
Today
There are no roles. Every authenticated caller can create and delete users, set anyone's password and mint API keys —
internal/api/users.goandauth.gosay so in a comment ("open to any authenticated caller"). The only gate isAuthMiddleware(internal/api/middleware.go), which accepts a session cookie or a Bearer API key.Scope
is_admin(or a role column) tousers, with a migration.POST /api/bootstrapcreates the first user as an admin.AdminOnlymiddleware, alongside the existingAuthMiddleware.Notes
Team roles (
owner/member) are a separate thing and arrive with teams. This issue is only the system-wide admin.Done when
A non-admin user cannot create users or API keys through the API, the existing admin keeps working, and the migration marks the current users appropriately (probably all of them, since everyone has these powers today — decide explicitly).