permissions-demo-tokens
Find real users in the local ebdb MySQL database that hold a specific permission role, then generate JWT tokens for them via the existing sandbox token CLI โ so you can test different permission levels in a local environment. Ported from cursor-rules; used by auth-security when testing RBAC.
Local-only, demo/test purpose. This operates against the local
ebdbsandbox DB and the sandbox token CLI โ never production. The tokens are for testing permission boundaries locally.
Supported roles: super-admin ยท organization-admin ยท community-admin ยท leader (optionally restricted by organization and/or community, and optionally "only this role" excluding stronger admin roles).
Prerequisitesโ
backend-servicesis available with a.envcarryingSQL_HOST/SQL_PORT/SQL_USERNAME/SQL_PASSWORD/SQL_NAME.- Local MySQL is running with the
ebdbschema and the usual tables:users,users_permissions,organizations_admins,communities_admins,groups. - The sandbox PHP token CLI (in the consumer/backend sandbox) for minting the JWT.
Workflowโ
- Find a user with the role. Query
ebdbfor a user holding the requested role โ joinuserswithusers_permissions/organizations_admins/communities_adminsas appropriate; filter by org/community if asked; if "only this role" is requested, exclude users who also hold a stronger admin role. - Confirm the candidate โ surface the user id + email + the role(s) they actually hold, so the developer picks deliberately (don't silently grab the first row).
- Mint the JWT via the sandbox token CLI for that user:
docker exec -it php-nginx-dev php yii token/create <user-id> --oId=<organization-id>
- Return the user identity + the JWT + which role/scope it represents, and a one-line "use this to test X".
A bundled helper (
find_permission_user.mjs, in the cursor-rules version) automates step 1 against the.env-configured DB. Port/run it from this skill's directory when present; otherwise do the query directly. Never log the minted JWT into shared output beyond what the developer needs locally.
Cross-referencesโ
auth-securityโ owns Cognito/JWT/RBAC; uses this skill to exercise permission boundaries in tests.databaseโ owns theebdb/Aurora schema this queries.- Source: cursor-rules
bewith-permissions-demo-tokensskill (+ itsfind_permission_user.mjsscript + the sandbox token CLI).