Permissions Matrix π‘ BETA
Read the effective permission set for a user or bot from the RBAC tables and the session context, not from a role name alone.
Admin guide Β· permission lookup runbook
| When to use | Before you start | Steps | Verify | Roll back |
|---|---|---|---|---|
| Answering "can this user do X?", reviewing a role change | DB access, a test identity | Resolve groups, inspect effective permissions | Matrix matches observed access | Restore the previous role assignment |
When to use
Use this runbook when access is denied unexpectedly or when a role change must be checked before it is announced.
Before you start
- Permissions are resolved from users, groups and roles in the RBAC tables. A role name is a label; the effective set is what the resolver returns.
- There are two execution contexts. User context is scoped to the acting user and tenant; system context is a service identity. A script that runs in system context can do more than the user who triggered it.
- The
rolescope variable is available to BASIC scripts (web and WhatsApp), which is how tools are gated instart.bas. See role-based tools. - Anonymous access is a separate case: it must never inherit an administrative permission.
Steps
# 1. Find the RBAC tables and the resolver in source.
grep -RIn "rbac_user_groups\|resolve_user_role\|effective_permission" \
botserver/src botserver/crates --include='*.rs' | head -30
# 2. Resolve the test user's group membership.
psql -h localhost -U postgres -d botserver -c \
"SELECT user_id, group_name FROM rbac_user_groups WHERE user_id = '<user-id>';"
# 3. Compare with what the app actually allows for that identity.
# Exercise one read and one write in a test session.
# 4. Inspect the audit trail for the action just performed.
grep -E "AUDIT|role|permission" botserver.log | tail -20
Verify
| Check | Surface | Pass condition |
|---|---|---|
| Role resolution | resolver source | group names drive the role, not a client field |
| Effective set | rbac_user_groups query |
matches the expected membership |
| File operations | test session | no access outside the tenant |
| Communication | test session | send/receive scoped to the user |
| Administrative functions | non-admin session | refused |
| Anonymous | anonymous session | no admin capability |
| Audit | server log | action recorded without secrets |
Roll back
π΄ Restore the previous role or group assignment through the documented surface and re-run the table. An unexpected grant is handled as an incident under incident response.