@happyvertical/smrt-users 0.38.2 → 0.38.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +22 -0
- package/dist/chunks/{TerminalAuthService-BLxjzcQj.js → TerminalAuthService-B7RYkS27.js} +732 -87
- package/dist/chunks/TerminalAuthService-B7RYkS27.js.map +1 -0
- package/dist/collections/RoleCollection.d.ts +6 -1
- package/dist/collections/RoleCollection.d.ts.map +1 -1
- package/dist/collections/RolePermissionCollection.d.ts +35 -0
- package/dist/collections/RolePermissionCollection.d.ts.map +1 -1
- package/dist/collections/index.d.ts +2 -2
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +101 -436
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +35 -4
- package/dist/models/Permission.d.ts +7 -4
- package/dist/models/Permission.d.ts.map +1 -1
- package/dist/services/MagicLinkService.d.ts.map +1 -1
- package/dist/services/OperationPermissionService.d.ts +45 -0
- package/dist/services/OperationPermissionService.d.ts.map +1 -0
- package/dist/services/PermissionCatalogService.d.ts +12 -0
- package/dist/services/PermissionCatalogService.d.ts.map +1 -1
- package/dist/services/PermissionResolver.d.ts.map +1 -1
- package/dist/services/SessionService.d.ts.map +1 -1
- package/dist/services/TenantService.d.ts.map +1 -1
- package/dist/services/TerminalAuthService.d.ts.map +1 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +9 -8
- package/dist/sveltekit.js +1 -1
- package/package.json +11 -11
- package/dist/chunks/TerminalAuthService-BLxjzcQj.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -44,6 +44,28 @@ The hard block reflects the tenant cascade's **net** resolution, not an
|
|
|
44
44
|
unconditional union of every DENY in the chain — so a more-specific tenant GRANT
|
|
45
45
|
(e.g. a child sub-tenant re-granting a permission its parent DENYs) still wins.
|
|
46
46
|
|
|
47
|
+
## Operation Permission Guards
|
|
48
|
+
|
|
49
|
+
- Use `assertOperationPermission()` for hand-written mutations in SvelteKit form
|
|
50
|
+
actions, custom endpoints, CLI scripts, and jobs. It derives the same
|
|
51
|
+
`<collection>.<action>` slugs as `PermissionCatalogService` (`list`/`get` →
|
|
52
|
+
`read`), requires the slug to exist in the catalog, then resolves permissions
|
|
53
|
+
through `PermissionResolver`.
|
|
54
|
+
- `assertOperationPermission()` throws fail-closed by default. Use
|
|
55
|
+
`{ onDeny: 'return' }`, `checkOperationPermission()`, or
|
|
56
|
+
`hasOperationPermission()` when a structured/boolean result is needed.
|
|
57
|
+
- System context and super-admin bypass context are honored for parity with
|
|
58
|
+
Postgres RLS. Pass `{ allowSuperAdminBypass: false }` on money-class or
|
|
59
|
+
separation-of-duties operations that must require an explicit permission grant.
|
|
60
|
+
- Seed role mappings with `RolePermissionCollection.seedRolePermissions()` or
|
|
61
|
+
`RoleCollection.seedSystemRoles({ seedPermissions: true })`. The default
|
|
62
|
+
matrix maps owner/admin to all catalog permissions, member to read/create for
|
|
63
|
+
ordinary app resources, and viewer to read-only. Member create grants
|
|
64
|
+
intentionally exclude users/RBAC authority and security resources (`users`,
|
|
65
|
+
`tenants`, `roles`, `permissions`, memberships, groups, sessions, magic-link
|
|
66
|
+
tokens, and related join/override tables). Re-seeding is additive and
|
|
67
|
+
idempotent; pruning stale mappings requires `{ prune: true }`.
|
|
68
|
+
|
|
47
69
|
**Critical**: `getGroupIdsForTenant(userId, tenantId)` (joins with groups table to scope by tenant). Never use `getGroupIds()` — it's cross-tenant.
|
|
48
70
|
|
|
49
71
|
## Hierarchical Tenants
|