fix(mobile-api): fail closed for admins outside the company model
An admin with no company who is not a super admin now gets 403 COMPANY_REQUIRED on every company-scoped request instead of seeing all companies. The module check and the email detail treat only a real super admin (no company and role 1) as super; a company user still holding role 1 gets only what their other roles grant. 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
7d29d89b3f
commit
998e04b844
12 files changed
+122
-10
No files matched your search
@@ -0,0 +1,18 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Invalid admins fail closed
|
||||
|
||||
The system SHALL refuse every company-scoped request from an admin with no company who is not a super admin, and SHALL grant a company user who holds the super admin role only the modules and records their company and other roles allow.
|
||||
|
||||
#### Scenario: Admin without a company who is not a super admin
|
||||
|
||||
- **GIVEN** an admin user with no company and no super admin role
|
||||
- **WHEN** they open Leads, Events, Users or any other company-scoped list or record
|
||||
- **THEN** the request is refused with 403
|
||||
- **AND** no company's records are returned
|
||||
|
||||
#### Scenario: Company user still holding the super admin role
|
||||
|
||||
- **GIVEN** a user of INS who holds the super admin role and a role granting only Leads
|
||||
- **WHEN** they open Users or another super admin's email
|
||||
- **THEN** the request is refused with 403
|
||||
Reference in new issue
Block a user