Skip to content

fix(rbac): scope role_permissions unique index per property - #277

Merged
telivity-otaip merged 1 commit into
mainfrom
cursor/rbac-property-perms-2642
Aug 3, 2026
Merged

fix(rbac): scope role_permissions unique index per property#277
telivity-otaip merged 1 commit into
mainfrom
cursor/rbac-property-perms-2642

Conversation

@telivity-otaip

@telivity-otaip telivity-otaip commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

role_permissions grants were unique only on (role_id, permission_key). Once any property seeded a system role, later property bootstraps could skip grants for the same role/permission pair. Permissions checks are property-scoped, so those tenants effectively had no grants.

Changes

  • Migration 0016_role_permissions_per_property.sql: unique index is (property_id, role_id, permission_key)
  • Matching Drizzle schema + push-schema.ts updates

Cloud tenant bootstrap was silently skipping permission grants once any
property had seeded the same system roles, because the unique index was
only (role_id, permission_key). New tenants then had zero grants and
housekeeping.manage (Generate Stayovers) failed closed.

Co-authored-by: telivity-otaip <telivity-otaip@users.noreply.github.com>
@telivity-otaip
telivity-otaip marked this pull request as ready for review August 3, 2026 14:30
@telivity-otaip
telivity-otaip merged commit 2db6ccc into main Aug 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants