Role-Based Tool Access π‘ BETA
Gate tool execution on the resolved role scope variable and prove that a non-admin session cannot run an admin tool.
Admin guide Β· tool gating runbook
| When to use | Before you start | Steps | Verify | Roll back |
|---|---|---|---|---|
| Adding an admin-only tool, after a role change | Bot repo with .gbdialog and .gbot access |
Edit start.bas, sync, test two roles |
Admin tool refused for non-admin | Restore the previous script in the ALM repo |
When to use
Use this runbook when a tool must be visible only to administrators, or when a tool appears for a user who should not have it.
Before you start
- The
rolescope variable comes fromresolve_user_role. It is available to BASIC scripts on web and WhatsApp channels. - Gate in
start.baswithIF role = "admin" THEN β¦ USE TOOL β¦ / ADD SUGGESTION β¦ END IF. The declaration gate is declarative and does not hardcode a role list inside the tool itself. - Tool execution only runs tools associated with the session. A hidden suggestion is not the enforcement; the execution check is.
- For git-owned bots, edit
.gbdialog/start.basin the bot's ALM repository; the drive monitor materialises it within about 15 seconds. Never fix a script by writing straight into Drive.
Steps
# 1. Inspect the committed entry point in the bot's ALM repository.
git -C <bot-repo> show HEAD:.gbdialog/start.bas
# 2. Add or correct the role guard, then commit and push in that repository.
# Example condition (BASIC): IF role = "admin" THEN ... END IF
# 3. Confirm the drive monitor materialised the change.
grep -E "drive_monitor|Compiled|Registered tool" botserver.log | tail -30
Verify
| Check | Surface | Pass condition |
|---|---|---|
| Source of truth | bot ALM repository | guard is committed there, not only in Drive |
| Web role | admin session | admin tool offered and executes |
| Non-admin role | standard session | admin tool absent and refused |
| WhatsApp role | channel session | same result as web |
| Execution gate | tool call attempt | unassociated tool never runs |
| Sync | botserver.log |
new script compiled |
Roll back
π΄ Revert start.bas in the bot's ALM repository and push; the drive monitor will materialise the previous version. Do not restore by editing Drive. Record an unintended grant through incident response.