feat: make user limit configurable from admin user management (#18)

Store the per-instance user cap in settings (default 20) and expose
GET/PUT /admin/users/limit endpoints. The user management page now lets
admins view and update the limit without touching system settings.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: truewhile <truewhile@users.noreply.github.com>
This commit is contained in:
truewhile
2026-09-02 17:10:07 +08:00
committed by GitHub
parent da99182222
commit bbb512760a
11 changed files with 383 additions and 23 deletions
+17 -1
View File
@@ -64,8 +64,24 @@ export interface SystemUpdateStatus {
started_at?: string
}
export interface UserListResponse {
users: User[]
max_users: number
current_users: number
}
export interface UserLimitResponse {
max_users: number
current_users: number
}
export const adminAPI = {
listUsers: () => api.get<User[]>('/admin/users').then((r) => r.data),
listUsers: () => api.get<UserListResponse>('/admin/users').then((r) => r.data),
getUserLimit: () => api.get<UserLimitResponse>('/admin/users/limit').then((r) => r.data),
updateUserLimit: (maxUsers: number) =>
api.put<UserLimitResponse>('/admin/users/limit', { max_users: maxUsers }).then((r) => r.data),
createUser: (payload: { username: string; password: string }) =>
api.post<User>('/admin/users', payload).then((r) => r.data),