docs: propose add-admin-auth-users-roles (change 2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
c31b6630eb
commit
f97bf48d93
7 files changed
+406
No files matched your search
@@ -0,0 +1,48 @@
|
||||
# Spec Delta
|
||||
|
||||
## Purpose
|
||||
|
||||
Admins with the Roles module define roles and choose which back-office modules each role grants, which controls the menus and endpoints its users reach.
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Role list and edit
|
||||
|
||||
The system SHALL let an admin with `BO_ROLES` list, create and rename admin roles. Role names SHALL be unique. The member role SHALL NOT appear in the list.
|
||||
|
||||
#### Scenario: Create role
|
||||
|
||||
- **WHEN** an admin with `BO_ROLES` creates role `ROLE_SALES`
|
||||
- **THEN** it appears in the role list and can be assigned to users
|
||||
|
||||
#### Scenario: Duplicate name
|
||||
|
||||
- **GIVEN** role `ROLE_SALES` exists
|
||||
- **WHEN** an admin creates another role named `ROLE_SALES`
|
||||
- **THEN** the save is refused with a message
|
||||
|
||||
### Requirement: Role permissions
|
||||
|
||||
The system SHALL let an admin with `BO_ROLES` choose, for a role, which back-office modules it grants, shown as the module tree. Saving SHALL replace the role's module grants with the chosen set. The super admin role's grants SHALL NOT be editable.
|
||||
|
||||
#### Scenario: Grant Users module
|
||||
|
||||
- **GIVEN** role `ROLE_SALES` without `BO_USERS`
|
||||
- **WHEN** an admin grants `BO_USERS` to `ROLE_SALES` and saves
|
||||
- **THEN** users with `ROLE_SALES` see Users in the sidebar after their next login or session refresh
|
||||
- **AND** `GET /api/admin/users` responds 200 for them
|
||||
|
||||
#### Scenario: Self lock-out
|
||||
|
||||
- **GIVEN** the admin's only role that grants `BO_ROLES` is the role being edited
|
||||
- **WHEN** they remove `BO_ROLES` from it and save
|
||||
- **THEN** the save is refused with a message, so no admin loses access to role management by mistake
|
||||
|
||||
### Requirement: Back-office module set
|
||||
|
||||
The system SHALL hold Co-Lite's back-office modules in the module table, with a root entry and one entry per admin screen. This change SHALL add `BO_USERS` (Users) and `BO_ROLES` (Roles). Later changes add their own modules.
|
||||
|
||||
#### Scenario: Seeded modules
|
||||
|
||||
- **WHEN** the local stack starts from an empty database
|
||||
- **THEN** the super admin's sidebar shows Users and Roles and no Tastefully back-office entries
|
||||
Reference in new issue
Block a user