feat(rbac): split setting:view into panel settings and a permission-free profile
Some checks failed
Backend Tests / pytest (Python 3.12) (push) Failing after 1m22s
Deploy to Production / Trigger production update (push) Failing after 11s

setting:view used to gate the whole /settings page, which mixed panel-wide
configuration with a user's own account. Revoking it to keep a standard user
out of the panel settings also took away their profile, password, 2FA and SSH
keys, so the permission could not be used for what it names.

The account half now lives at /profile: its endpoints are self-scoped and only
require a session, so the page carries no permission at all and is reached from
the user menu (and Ctrl+K) rather than a sidebar group. /settings keeps the
panel-wide tabs behind setting:view, with saving gated on setting:update,
security on setting:manage and the SMTP/Telegram channels on is_admin, matching
what each endpoint checks.

The shipped "user" role no longer gets setting:view. Migration 42 drops it from
roles holding it without setting:update/manage, since those grants only existed
to reach the profile page; it runs once (marker in panel_settings) so a later
deliberate grant is not reverted on the next start.
This commit is contained in:
2026-08-11 20:07:34 +05:00
parent 991daddd63
commit bddbf15652
15 changed files with 668 additions and 447 deletions

View File

@@ -513,6 +513,9 @@ INSERT INTO roles (name, display_name, description, permissions, is_system, is_a
"setting:view": true,
"notification:view": true, "notification:manage": true
}', TRUE, TRUE),
-- No setting:view here: it grants the panel-wide settings page. A user's own
-- profile (password, 2FA, SSH keys, notification preferences) lives at /profile
-- and is reachable without any permission.
('user', 'User', 'Standard user with limited access', '{
"dashboard:view": true,
"server:view": true,
@@ -521,7 +524,6 @@ INSERT INTO roles (name, display_name, description, permissions, is_system, is_a
"template:view": true,
"storage:view": true,
"ipam:view": true,
"setting:view": true,
"notification:view": true, "notification:manage": true
}', TRUE, TRUE),
('demo', 'Demo User', 'Read-only access for demonstration', '{