@objectstack/plugin-security 6.9.0 → 7.1.0
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/README.md +13 -17
- package/dist/index.d.mts +818 -231
- package/dist/index.d.ts +818 -231
- package/dist/index.js +219 -369
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +217 -368
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -35,29 +35,25 @@ await kernel.bootstrap();
|
|
|
35
35
|
|
|
36
36
|
### Multi-tenant vs single-tenant
|
|
37
37
|
|
|
38
|
-
`SecurityPlugin`
|
|
38
|
+
`SecurityPlugin` is single-tenant by default. It enforces RBAC, owner-based RLS, and Field-Level Security regardless of mode.
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
- Honours the wildcard `tenant_isolation` RLS policy
|
|
42
|
-
(`organization_id = current_user.organization_id`) shipped with the
|
|
43
|
-
default `member_default` / `viewer_readonly` permission sets.
|
|
44
|
-
|
|
45
|
-
For single-tenant deployments, switch it off:
|
|
40
|
+
For **multi-tenant** (logical row-level Organization scoping) install [`@objectstack/plugin-org-scoping`](../plugin-org-scoping/README.md) *before* SecurityPlugin:
|
|
46
41
|
|
|
47
42
|
```typescript
|
|
48
|
-
|
|
43
|
+
import { OrgScopingPlugin } from '@objectstack/plugin-org-scoping';
|
|
44
|
+
|
|
45
|
+
await kernel.use(new OrgScopingPlugin()); // MUST be BEFORE SecurityPlugin
|
|
46
|
+
await kernel.use(new SecurityPlugin());
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
`current_user.organization_id`
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
SecurityPlugin probes `getService('org-scoping')` at start time:
|
|
50
|
+
|
|
51
|
+
- **Service present** → keeps the wildcard `tenant_isolation` RLS policy (`organization_id = current_user.organization_id`) shipped with the default `member_default` / `viewer_readonly` permission sets.
|
|
52
|
+
- **Service absent** → strips those wildcard policies so single-tenant deployments aren't filtered to zero rows.
|
|
53
|
+
|
|
54
|
+
`organization_id` auto-injection on insert is provided by OrgScopingPlugin; `owner_id` auto-injection always runs in SecurityPlugin regardless.
|
|
57
55
|
|
|
58
|
-
In CLI / dev-server mode the
|
|
59
|
-
`OS_MULTI_TENANT` environment variable (default `true`); set
|
|
60
|
-
`OS_MULTI_TENANT=false` before `objectstack serve` / `pnpm dev` to disable.
|
|
56
|
+
In CLI / dev-server mode the `OS_MULTI_TENANT` environment variable (default `false`) toggles whether the runtime registers `OrgScopingPlugin` alongside `SecurityPlugin`. Set `OS_MULTI_TENANT=true` before `objectstack serve` / `pnpm dev` to enable.
|
|
61
57
|
|
|
62
58
|
## Key Exports
|
|
63
59
|
|