docs: document per-user quotas and bump version to v1.7.0
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 8s
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 8s
Update README/README.ru, CHANGELOG/CHANGELOG.ru, WIKI and VERSION to
cover the per-user resource quotas feature (commit 35dcbfd): instance/
vCPU/RAM/disk limits, HTTP 429 enforcement, quota:view/quota:manage
permissions, admin + self-service endpoints and UI.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
13
CHANGELOG.md
13
CHANGELOG.md
@@ -4,6 +4,19 @@ All notable changes to PVEmanager will be documented in this file.
|
||||
|
||||
---
|
||||
|
||||
## [v1.7.0] - 2026-06-26
|
||||
|
||||
### 🎯 Quotas
|
||||
|
||||
- **Per-user resource quotas** — limit each user's number of instances and the summed vCPU, RAM and disk across their VMs/LXC. A missing quota row or a `NULL` column means *unlimited* for that metric, so admins and unrestricted users are never blocked
|
||||
- Backend: new `UserQuota` model (`user_quotas` table) and `quota_service` (`get_user_usage` / `check_quota`); usage is computed from the `vm_instances` cache (`owner_id`) — non-deleted, non-template instances only; enforcement raises **HTTP 429** on VM/LXC deploy when a limit would be exceeded
|
||||
- Permissions: new `quota:view` and `quota:manage` RBAC permissions (category *User Management*, both require `user:view`)
|
||||
- API: `GET/PUT /api/users/{id}/quota` (admin) returns limits plus current usage; `GET /api/quota` (self-service) returns the current user's own limits and usage
|
||||
- Frontend: admin quota dialog with usage bars on the Users page; own-limits card on the Settings page; remaining-quota hint in the Create Instance wizard config step; `useUserQuota` / `useSetUserQuota` / `useMyQuota` hooks; RU/EN locales
|
||||
- Migration: `user_quotas` table added via `backend/migrations/migrations.py`
|
||||
|
||||
---
|
||||
|
||||
## [v1.6.0] - 2026-06-23
|
||||
|
||||
### ✨ Images
|
||||
|
||||
@@ -4,6 +4,19 @@
|
||||
|
||||
---
|
||||
|
||||
## [v1.7.0] - 2026-06-26
|
||||
|
||||
### 🎯 Квоты
|
||||
|
||||
- **Квоты ресурсов на пользователя** — ограничение количества инстансов и суммарных vCPU, RAM и диска по всем VM/LXC пользователя. Отсутствие записи квоты или значение `NULL` в столбце означает *безлимит* по этой метрике, поэтому администраторы и пользователи без ограничений никогда не блокируются
|
||||
- Бэкенд: новая модель `UserQuota` (таблица `user_quotas`) и `quota_service` (`get_user_usage` / `check_quota`); использование вычисляется из кэша `vm_instances` (`owner_id`) — учитываются только не удалённые и не шаблонные инстансы; при превышении лимита развёртывание VM/LXC прерывается с **HTTP 429**
|
||||
- Права: новые RBAC-разрешения `quota:view` и `quota:manage` (категория *Управление пользователями*, оба требуют `user:view`)
|
||||
- API: `GET/PUT /api/users/{id}/quota` (админ) возвращает лимиты вместе с текущим использованием; `GET /api/quota` (self-service) возвращает собственные лимиты и использование текущего пользователя
|
||||
- Фронтенд: диалог квот с полосами использования на странице Пользователей (админ); карточка собственных лимитов на странице Настроек; подсказка об остатке квоты на шаге конфигурации в мастере создания инстанса; хуки `useUserQuota` / `useSetUserQuota` / `useMyQuota`; локали RU/EN
|
||||
- Миграция: таблица `user_quotas` добавлена через `backend/migrations/migrations.py`
|
||||
|
||||
---
|
||||
|
||||
## [v1.6.0] - 2026-06-23
|
||||
|
||||
### ✨ Images
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
**Modern web panel for managing Proxmox servers, virtual machines and LXC containers**
|
||||
|
||||
[](CHANGELOG.md)
|
||||
[](CHANGELOG.md)
|
||||
[](LICENSE)
|
||||
[](compose.yml)
|
||||
[](backend/)
|
||||
@@ -42,6 +42,7 @@ PVEmanager is a self-hosted web panel that provides a unified interface for mana
|
||||
- **RBAC v2** — granular role-based access control with per-resource permissions
|
||||
- **Server assignment** — directly assign specific Proxmox servers to users with workspace-conflict validation
|
||||
- **VM/LXC ownership** — assign an owner user to any VM or LXC container
|
||||
- **Per-user quotas** — limit each user's number of instances and total vCPU, RAM and disk; enforced at deploy time (HTTP 429), with admin management and self-service usage view
|
||||
- **Session management** — active session list, remote session revocation, login protection
|
||||
- **Smart login redirect** — users are automatically routed to the first page they have access to
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
**Современная веб-панель для управления серверами Proxmox, виртуальными машинами и контейнерами LXC**
|
||||
|
||||
[](CHANGELOG.md)
|
||||
[](CHANGELOG.md)
|
||||
[](LICENSE)
|
||||
[](compose.yml)
|
||||
[](backend/)
|
||||
@@ -40,6 +40,7 @@ PVEmanager — это самостоятельно размещаемая веб
|
||||
- **Удаленные команды** — выполняйте команды bash через QEMU Guest Agent- **Управление SSH-ключами** — личная библиотека SSH-ключей для каждого пользователя; ключи можно выбирать при развёртывании VM/LXC; админ может управлять ключами любого пользователя- **RBAC v2** — детальный контроль доступа на основе ролей с разрешениями для каждого ресурса
|
||||
- **Назначение серверов** — напрямую назначайте конкретные серверы Proxmox пользователям с проверкой конфликтов рабочих областей
|
||||
- **Владелец ВМ/LXC** — назначайте пользователя-владельца любой ВМ или контейнеру LXC
|
||||
- **Квоты на пользователя** — ограничение количества инстансов и суммарных vCPU, RAM и диска для каждого пользователя; проверка при развёртывании (HTTP 429), управление администратором и просмотр собственного использования
|
||||
- **Управление сессиями** — список активных сессий, отзыв удаленных сессий, защита входа
|
||||
- **Умное перенаправление входа** — пользователи автоматически маршрутизируются на первую страницу, к которой у них есть доступ
|
||||
|
||||
|
||||
59
WIKI.md
59
WIKI.md
@@ -31,10 +31,11 @@
|
||||
23. [Workspaces](#-workspaces)
|
||||
24. [User → Server Assignment](#-user--server-assignment)
|
||||
25. [VM / LXC Ownership](#-vm--lxc-ownership)
|
||||
26. [Logs & Audit](#-logs--audit)
|
||||
27. [Deployment Guide](#-installation-and-deployment)
|
||||
28. [Troubleshooting](#-troubleshooting)
|
||||
29. [FAQ](#-faq)
|
||||
26. [Quotas](#-quotas)
|
||||
27. [Logs & Audit](#-logs--audit)
|
||||
28. [Deployment Guide](#-installation-and-deployment)
|
||||
29. [Troubleshooting](#-troubleshooting)
|
||||
30. [FAQ](#-faq)
|
||||
|
||||
---
|
||||
|
||||
@@ -226,6 +227,12 @@ This section summarizes key API endpoints. All require JWT authentication.
|
||||
- `PUT /api/roles/{id}` — update role (admin)
|
||||
- `DELETE /api/roles/{id}` — delete role (admin)
|
||||
|
||||
### Quotas
|
||||
|
||||
- `GET /api/users/{id}/quota` — get a user's quota plus current usage (requires `quota:view`)
|
||||
- `PUT /api/users/{id}/quota` — set a user's quota; `null` per metric = unlimited (requires `quota:manage`)
|
||||
- `GET /api/quota` — get the current user's own quota and usage (self-service)
|
||||
|
||||
### Settings
|
||||
|
||||
- `GET /settings/api/panel` — get panel settings
|
||||
@@ -372,6 +379,17 @@ This section summarizes key API endpoints. All require JWT authentication.
|
||||
- Login protection (lockout, rate limiting)
|
||||
- Audit logs
|
||||
|
||||
### Quotas
|
||||
|
||||
Per-user resource limits enforced when deploying VMs/LXC:
|
||||
|
||||
- **Limited metrics** — number of instances, total vCPU (cores), total RAM (MB) and total disk (GB), summed across the user's non-deleted, non-template instances
|
||||
- **Unlimited by default** — a user with no quota row, or a metric left blank (`NULL`), is unrestricted for that metric; admins are never blocked
|
||||
- **Enforcement** — deploying an instance that would exceed any limit is rejected with **HTTP 429** and a bilingual message showing the projected value vs. the limit
|
||||
- **Admin management** — set limits per user on the **Users** page (quota dialog with live usage bars); requires the `quota:manage` permission (`quota:view` to read)
|
||||
- **Self-service** — each user can see their own limits and current usage on the **Settings** page, and the remaining quota is shown as a hint in the Create Instance wizard
|
||||
- Current usage is derived from the `vm_instances` cache (`owner_id`), where RAM is stored in MB and disk in GB
|
||||
|
||||
### Monitoring
|
||||
|
||||
- Real-time CPU, RAM, Disk, Network metrics
|
||||
@@ -1875,6 +1893,39 @@ Open the VM detail page → **Owner** button → select user → Save.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Quotas
|
||||
|
||||
Per-user resource quotas cap how much a user can provision. Four metrics are limited, each summed across the user's **non-deleted, non-template** instances:
|
||||
|
||||
| Metric | Unit | Quota field |
|
||||
|---|---|---|
|
||||
| Instances | count | `max_instances` |
|
||||
| vCPU | cores | `max_cores` |
|
||||
| RAM | MB | `max_memory_mb` |
|
||||
| Disk | GB | `max_disk_gb` |
|
||||
|
||||
- **Unlimited by default** — a user with no quota row, or any metric left blank (`NULL`), is unrestricted for that metric. Admins and unconfigured users are never blocked.
|
||||
- **Enforcement** — deploying a VM/LXC that would push any metric over its limit is rejected with **HTTP 429** and a bilingual message (`Превышена квота … / Quota exceeded …`) showing the projected value vs. the limit.
|
||||
- **Usage source** — current usage is computed from the `vm_instances` cache (`owner_id`), where RAM is stored in MB and disk in GB (no conversion needed).
|
||||
|
||||
### Managing quotas (Admin)
|
||||
|
||||
**Users** page → quota dialog. Live usage bars show current consumption against each limit. Leave a field empty for *unlimited*. Requires the `quota:manage` permission (`quota:view` to read).
|
||||
|
||||
### Self-service
|
||||
|
||||
Each user sees their own limits and current usage on the **Settings** page. The **Create Instance** wizard shows the remaining quota as a hint on the configuration step.
|
||||
|
||||
### REST API
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/api/users/{id}/quota` | A user's limits + current usage (requires `quota:view`) |
|
||||
| `PUT` | `/api/users/{id}/quota` | Set a user's limits; `null` per metric = unlimited (requires `quota:manage`) |
|
||||
| `GET` | `/api/quota` | Current user's own limits + usage (self-service) |
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Troubleshooting
|
||||
|
||||
### Startup Issues
|
||||
|
||||
Reference in New Issue
Block a user