Users cannot have other users' exclusive roles
The :roles checkbox list on the users add/edit form lists every
role in RBAC, including other users' name:exclusive roles. The
RBAC layer rejects such assignments at write time, so the UI offers
options that can only fail. Root cause: the :users special case in
allowed-values-for-field (backend.lisp) filters only system roles
and the current viewer's exclusive role, and selectable-roles
(admin branch) has the same blind spot. Resources are unaffected:
other users' exclusives are legitimately assignable there
(point-to-point sharing), so their presence is correct on that path.
Fix: filter all :exclusive-suffixed roles out of the users-roles
palette (a shareable-exclusive-role-p analogue without the
admin/guest exception).
Implemented per plan, including all six review nits. New
exclusive-role-p (backend.lisp, beside shareable-exclusive-role-p)
tests the :exclusive suffix via u:ends-with;
shareable-exclusive-role-p is now defined in terms of it (existing
sharing tests unchanged and green). The :users :roles case in
allowed-values-for-field removes every exclusive-role-p hit plus
"admin" / "settings" / "logged-in"; the when user /
a:exclusive-role-for closure trick is gone (admin:exclusive,
guest:exclusive, and the viewer's own exclusive all fall out of the
suffix test). selectable-roles deliberately untouched — the resource
palette intentionally lists other users' exclusives for sharing.
Tests: exclusive-role-p unit test beside its sibling, new
allowed-values-for-field-excludes-other-users-exclusives (two
throwaway users + (notany #'exclusive-role-p roles) so any future
leak fails), and the stale "same set as selectable-roles" docstring
in ...-excludes-settings-... corrected. Full (run-tests) green:
1539 checks / 26 groups. Live smoke: admin's :users roles palette
shows only shareable roles, zero exclusives. No frontend, model, or
docs changes.
Plan: exclusive-roles-bug-plan.org.
- Slot
- 26800
- Status
- 60 Done
- Tags
- backend
- Contributors
- Donnie