feat: manage bot accounts from the admin UI, API and CLI (#38966)

Adds first-class bot accounts (`UserTypeBot`): local, password-less
users for automation that authenticate only with access tokens.

1. Admin UI: create bots, filter users by type, manage a bot's access
tokens, convert between user and bot
2. API: `POST /admin/users/{username}/convert-type`, and user objects
gain a GitHub-compatible `type` (`User`, `Organization`, `Bot`)
3. CLI: `gitea admin user change-type`, `--user-type` accepts `User` or
`Bot` case-insensitively
4. Converting keeps the password, 2FA, OAuth2 grants and access tokens,
and since sign-in rejects bots, converting back restores the account.
Only local, non-admin accounts can be converted, and conversions are
audited
5. Session, reverse proxy, SSPI, external source and password reset
sign-in reject non-individual users, so a bot never gets an interactive
session
6. Bots receive no notifications or emails

Co-authored-by: Nicolas <bircni@icloud.com>
Co-authored-by: joestump <joe@joestump.net>
Co-authored-by: Joe Stump <joe@stu.mp>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Joe (Agent) Stump
2026-09-18 12:43:36 +00:00
committed by GitHub
co-authored by Nicolas joestump Joe Stump silverwind Lunny Xiao
parent db7dbd5a6b
commit 3bec08f998
71 changed files with 1246 additions and 330 deletions
+1
View File
@@ -71,6 +71,7 @@ var (
UserActive = define("user:status:active", "Changed activation status of user {scope} to {active}.")
UserRestricted = define("user:status:restricted", "Changed restricted status of user {scope} to {restricted}.")
UserAdmin = define("user:status:admin", "Changed admin status of user {scope} to {admin}.")
UserType = define("user:type:update", "Changed type of user {scope} to {user_type}.")
UserName = define("user:name:update", "Changed user name from {previous_name} to {scope}.")
UserPassword = define("user:password", "Changed password of user {scope}.")
UserPasswordResetRequest = define("user:password:resetrequest", "Requested password reset for user {scope}.")