GRI-1970: users, roles and campus-scoped permissions #168
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!168
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-1970-campus-permissions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Users, a small fixed role set (admin / campus editor), and campus-scoped access, enforced at the auth extractor so a handler never has to check permissions itself.
migrations/0006_users_groups_and_permissions.sql: users (each with an optionalcampus_id), user groups (roles) and their permission grants.users.rs,user_groups.rs: CRUD for both, gated onusers.manage. An admin's own group can't be demoted by its sole admin; an admin can't delete their own account; creating an admin with acampus_idis rejected (an admin sees every campus by definition).auth/store.rs,auth/extractor.rs: load a user's permissions andcampus_idon session lookup.AuthUser::maychecks the permission;AuthUser::may_accesschecks whether a resource's owncampus_idis in scope for this user —Nonemeans every campus, same conventioncampus.rsuses elsewhere.shared::Permission::parse: the inverse of serialisation, so a grant row the running code no longer recognises isNonerather than silently becoming the wrong permission.Done when
Per the product owner's decision on this issue (2026-11-13) and the chief of staff's release note, the scope narrowed from the original device-group wording to campus-scoped access with a small role set: a campus editor scoped to campus A cannot see or reach a device in campus B, and non-admin management (users, settings) is refused. Covered by
permissions_integration.rs.Testing
scripts/local-gates.sh --rust-only: every gate passed (hooks, fmt, clippy, full test suite including the DB-backed integration suites, cargo deny, doc tests).Closes #44.
CI is green: cargo test, frontend-web, clippy, fmt, repo-boundary and the pre-push hook all pass on
d44cd3a7. The one standalone red job,cargo deny advisories, is RUSTSEC-2024-0429 in glib, pre-existing and unrelated to this change (Cargo.lock untouched here) — not part of the overall CI verdict, whichfj cireports as passed.This PR adds new auth/users/permissions/campus-scoping code (auth/store.rs, auth/extractor.rs, users.rs, user_groups.rs, migration 0006), so per process it needs a security review before merge. Handing to the security checker now.