feat(system-admin): implement bootstrap for system admin promotion and enhance system settings management
- Added WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL environment variable to promote a specified user to system admin on startup. - Introduced a new bootstrap process in `bootstrap.go` to handle the promotion logic. - Updated `.env.example` to document the new environment variable and its behavior. - Created new views for managing system administrators and system settings, including listing, promoting, and revoking admin privileges. - Enhanced the frontend to reflect the new system admin features, including UI elements for admin management and settings configuration. - Updated API interfaces to support system admin functionalities, ensuring proper data handling and user management.
This commit is contained in:
@@ -501,6 +501,15 @@ func (s *userService) UpdateUser(ctx context.Context, user *types.User) error {
|
||||
return s.userRepo.UpdateUser(ctx, user)
|
||||
}
|
||||
|
||||
// ListSystemAdmins lists users with IsSystemAdmin=true. Thin pass-through
|
||||
// to the repository; the handler enforces SystemAdmin gating, so the
|
||||
// service does not duplicate the role check here.
|
||||
func (s *userService) ListSystemAdmins(
|
||||
ctx context.Context, offset, limit int,
|
||||
) ([]*types.User, int64, error) {
|
||||
return s.userRepo.ListSystemAdmins(ctx, offset, limit)
|
||||
}
|
||||
|
||||
// UpdateUserPreferences applies a partial update over the user's
|
||||
// preferences blob. PATCH semantics: only keys present in `patch`
|
||||
// (non-nil pointer fields) replace the existing value; everything else
|
||||
|
||||
Reference in New Issue
Block a user