identity-permissions-tenancy
Use this sub-skill when a task touches BiSheng authentication, authorization, resource ownership, OpenFGA/ReBAC, RBAC menu permissions, multi-tenant isolation, admin scope, approval workflows, SSO/org sync, commercial gateway behavior, or cursor-pagination permission performance.
Start here
Run bundled helper commands from this sub-skill directory, or adjust the script path to this directory after import.
- Run the read-only pattern checker before or after a permission/tenant-sensitive edit:
python scripts/check_arch_rules.py --repo-root <bisheng-checkout>
- Read references/workflows.md for auth, PermissionService, tenant ContextVar, gateway, approval, and cursor workflows.
- Read references/troubleshooting.md for missing permissions, invisible resources, tenant leaks, SSO/gateway, and cursor list failures.
Owned responsibilities
- JWT/auth user loading, menu keys, and role/user/group relationships.
- PermissionService, OpenFGA/ReBAC model, failed tuple retry, owner grants, relation models, and resource authorization.
- Tenant ContextVar, SQLAlchemy tenant filter, tenant storage prefixes, tenant tree/admin scope, user-tenant membership, and quota hierarchy.
- Approval center and menu-approval mode when they affect access decisions.
- Commercial gateway integration, SSO/OAuth/LDAP/WeCom org sync, sensitive-word gateway filters, and rate/online limits.
- Cursor pagination patterns where permission filtering and DM8 keyset compatibility determine list correctness.
Route sibling areas instead of duplicating them
- Use
backend-core for generic FastAPI routes, schemas, service layering, and non-permission models.
- Use
frontend-apps for React route guards and UI rendering after the backend permission contract is known.
- Use
knowledge-rag for parser/vector/retrieval internals after visibility is proven correct.
- Use
workflow-engine for graph execution after app visibility and permissions are proven correct.
- Use
deployment-maintenance for running operational backfill/migration scripts.
Non-negotiables
- New resource authorization must go through PermissionService/OpenFGA-aware services; do not add direct role-access table shortcuts.
- Resource creation must write owner/authorization tuples or enqueue failed tuple compensation as designed.
- ORM tenant filtering applies to SELECT; raw SQL and bulk update/delete require explicit tenant-safe handling.
- Use tenant bypass helpers only for intentional cross-tenant maintenance reads/writes.
- Cursor pagination under permission filtering must advance by the last DB row, not the last visible row.
- Frontend 403 and menu visibility bugs should not be patched until backend/menu/plugin permission data is understood.
1---2name: identity-permissions-tenancy3description: "Operate on BiSheng JWT auth, RBAC/ReBAC/OpenFGA permissions,4 tenant isolation, admin scope, approval center, commercial gateway5 integration, and cursor permission performance."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/identity-permissions-tenancy9 disco-role: operating10license: Apache 2.011---1213# identity-permissions-tenancy1415Use this sub-skill when a task touches BiSheng authentication, authorization, resource ownership, OpenFGA/ReBAC, RBAC menu permissions, multi-tenant isolation, admin scope, approval workflows, SSO/org sync, commercial gateway behavior, or cursor-pagination permission performance.1617## Start here1819Run bundled helper commands from this sub-skill directory, or adjust the script path to this directory after import.2021221. Run the read-only pattern checker before or after a permission/tenant-sensitive edit:23 ```bash24 python scripts/check_arch_rules.py --repo-root <bisheng-checkout>25 ```262. Read [references/workflows.md](references/workflows.md) for auth, PermissionService, tenant ContextVar, gateway, approval, and cursor workflows.273. Read [references/troubleshooting.md](references/troubleshooting.md) for missing permissions, invisible resources, tenant leaks, SSO/gateway, and cursor list failures.2829## Owned responsibilities3031- JWT/auth user loading, menu keys, and role/user/group relationships.32- PermissionService, OpenFGA/ReBAC model, failed tuple retry, owner grants, relation models, and resource authorization.33- Tenant ContextVar, SQLAlchemy tenant filter, tenant storage prefixes, tenant tree/admin scope, user-tenant membership, and quota hierarchy.34- Approval center and menu-approval mode when they affect access decisions.35- Commercial gateway integration, SSO/OAuth/LDAP/WeCom org sync, sensitive-word gateway filters, and rate/online limits.36- Cursor pagination patterns where permission filtering and DM8 keyset compatibility determine list correctness.3738## Route sibling areas instead of duplicating them3940- Use `backend-core` for generic FastAPI routes, schemas, service layering, and non-permission models.41- Use `frontend-apps` for React route guards and UI rendering after the backend permission contract is known.42- Use `knowledge-rag` for parser/vector/retrieval internals after visibility is proven correct.43- Use `workflow-engine` for graph execution after app visibility and permissions are proven correct.44- Use `deployment-maintenance` for running operational backfill/migration scripts.4546## Non-negotiables4748- New resource authorization must go through PermissionService/OpenFGA-aware services; do not add direct role-access table shortcuts.49- Resource creation must write owner/authorization tuples or enqueue failed tuple compensation as designed.50- ORM tenant filtering applies to SELECT; raw SQL and bulk update/delete require explicit tenant-safe handling.51- Use tenant bypass helpers only for intentional cross-tenant maintenance reads/writes.52- Cursor pagination under permission filtering must advance by the last DB row, not the last visible row.53- Frontend 403 and menu visibility bugs should not be patched until backend/menu/plugin permission data is understood.