@objectstack/platform-objects 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/dist/apps/index.d.mts +30 -1
- package/dist/apps/index.d.ts +30 -1
- package/dist/apps/index.js +987 -37
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/index.mjs +987 -38
- package/dist/apps/index.mjs.map +1 -1
- package/dist/audit/index.d.mts +240 -64
- package/dist/audit/index.d.ts +240 -64
- package/dist/identity/index.d.mts +900 -82
- package/dist/identity/index.d.ts +900 -82
- package/dist/identity/index.js +384 -8
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/index.mjs +384 -8
- package/dist/identity/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6823 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6818 -100
- package/dist/index.mjs.map +1 -1
- package/dist/integration/index.d.mts +15 -4
- package/dist/integration/index.d.ts +15 -4
- package/dist/metadata/index.d.mts +30 -8
- package/dist/metadata/index.d.ts +30 -8
- package/dist/metadata-translations/index.d.mts +20 -0
- package/dist/metadata-translations/index.d.ts +20 -0
- package/dist/metadata-translations/index.js +4777 -0
- package/dist/metadata-translations/index.js.map +1 -0
- package/dist/metadata-translations/index.mjs +4775 -0
- package/dist/metadata-translations/index.mjs.map +1 -0
- package/dist/pages/index.d.mts +73 -0
- package/dist/pages/index.d.ts +73 -0
- package/dist/pages/index.js +371 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/index.mjs +368 -0
- package/dist/pages/index.mjs.map +1 -0
- package/dist/plugin.d.mts +35 -0
- package/dist/plugin.d.ts +35 -0
- package/dist/plugin.js +17562 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugin.mjs +17559 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/security/index.d.mts +806 -204
- package/dist/security/index.d.ts +806 -204
- package/dist/security/index.js +208 -1
- package/dist/security/index.js.map +1 -1
- package/dist/security/index.mjs +208 -1
- package/dist/security/index.mjs.map +1 -1
- package/dist/system/index.d.mts +45 -12
- package/dist/system/index.d.ts +45 -12
- package/package.json +17 -2
package/dist/security/index.mjs
CHANGED
|
@@ -340,6 +340,24 @@ var SysPermissionSet = ObjectSchema.create({
|
|
|
340
340
|
description: "JSON-serialized field-level read/write permissions",
|
|
341
341
|
group: "Permissions"
|
|
342
342
|
}),
|
|
343
|
+
system_permissions: Field.textarea({
|
|
344
|
+
label: "System Permissions",
|
|
345
|
+
required: false,
|
|
346
|
+
description: 'JSON-serialized array of system capability names (e.g. ["setup.access","studio.access","manage_users"])',
|
|
347
|
+
group: "Permissions"
|
|
348
|
+
}),
|
|
349
|
+
row_level_security: Field.textarea({
|
|
350
|
+
label: "Row-Level Security",
|
|
351
|
+
required: false,
|
|
352
|
+
description: "JSON-serialized array of row-level security policies (USING/CHECK clauses)",
|
|
353
|
+
group: "Permissions"
|
|
354
|
+
}),
|
|
355
|
+
tab_permissions: Field.textarea({
|
|
356
|
+
label: "Tab Permissions",
|
|
357
|
+
required: false,
|
|
358
|
+
description: "JSON-serialized map of app tab visibility (visible | hidden | default_on | default_off)",
|
|
359
|
+
group: "Permissions"
|
|
360
|
+
}),
|
|
343
361
|
// ── Status ───────────────────────────────────────────────────
|
|
344
362
|
active: Field.boolean({
|
|
345
363
|
label: "Active",
|
|
@@ -1059,7 +1077,186 @@ var defaultPermissionSets = [
|
|
|
1059
1077
|
modifyAllRecords: true
|
|
1060
1078
|
}
|
|
1061
1079
|
},
|
|
1062
|
-
systemPermissions: [
|
|
1080
|
+
systemPermissions: [
|
|
1081
|
+
"manage_users",
|
|
1082
|
+
"manage_metadata",
|
|
1083
|
+
"manage_platform_settings",
|
|
1084
|
+
"setup.access",
|
|
1085
|
+
"studio.access"
|
|
1086
|
+
]
|
|
1087
|
+
}),
|
|
1088
|
+
// ── Organization Administrator ──────────────────────────────────────
|
|
1089
|
+
//
|
|
1090
|
+
// Third tier between platform admin (`admin_full_access`) and rank-and-file
|
|
1091
|
+
// member. Lives at the *organization* scope: full CRUD on business
|
|
1092
|
+
// objects within their org (governed by `tenant_isolation` RLS), plus
|
|
1093
|
+
// `setup.access` so the Setup app shell is reachable.
|
|
1094
|
+
//
|
|
1095
|
+
// **Deliberately withheld** vs `admin_full_access`:
|
|
1096
|
+
// - `studio.access` — schema-design surfaces are platform-level (a
|
|
1097
|
+
// tenant cannot mutate the shared metadata) and Studio is hidden.
|
|
1098
|
+
// - `manage_metadata` — same reasoning.
|
|
1099
|
+
// - `manage_platform_settings` — global settings manifests
|
|
1100
|
+
// (mail / storage / AI / knowledge) and platform-only Setup pages
|
|
1101
|
+
// (sharing rules, audit logs, OAuth apps, JWKS, …) require this
|
|
1102
|
+
// and are hidden / 403'd for org admins. Tenant-scoped manifests
|
|
1103
|
+
// (`branding`, `feature_flags`) keep using `setup.access` so org
|
|
1104
|
+
// admins CAN configure their own org's branding.
|
|
1105
|
+
//
|
|
1106
|
+
// **Anti-escalation**: writes to the global RBAC tables
|
|
1107
|
+
// (`sys_role`, `sys_permission_set`, `sys_role_permission_set`,
|
|
1108
|
+
// `sys_user_permission_set`, `sys_user_role`) are denied. Allowing
|
|
1109
|
+
// them would let an org admin bind `admin_full_access` (which has no
|
|
1110
|
+
// RLS) to themselves and break out of tenant isolation. Reads are
|
|
1111
|
+
// permitted so the Roles / Permission Sets nav entries still render.
|
|
1112
|
+
//
|
|
1113
|
+
// Auto-granted to every `sys_member` whose role contains `owner` or
|
|
1114
|
+
// `admin` by `plugin-security/src/auto-org-admin-grant.ts`.
|
|
1115
|
+
PermissionSetSchema.parse({
|
|
1116
|
+
name: "organization_admin",
|
|
1117
|
+
label: "Organization Administrator",
|
|
1118
|
+
isProfile: true,
|
|
1119
|
+
objects: {
|
|
1120
|
+
"*": {
|
|
1121
|
+
allowRead: true,
|
|
1122
|
+
allowCreate: true,
|
|
1123
|
+
allowEdit: true,
|
|
1124
|
+
allowDelete: true,
|
|
1125
|
+
viewAllRecords: true,
|
|
1126
|
+
modifyAllRecords: true
|
|
1127
|
+
},
|
|
1128
|
+
// Identity tables — go through better-auth endpoints (invite,
|
|
1129
|
+
// accept, remove-member, transfer, …) rather than raw CRUD.
|
|
1130
|
+
...denyWritesOnManagedObjects(),
|
|
1131
|
+
// RBAC tables — read-only to prevent privilege escalation.
|
|
1132
|
+
sys_role: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false },
|
|
1133
|
+
sys_permission_set: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false },
|
|
1134
|
+
sys_role_permission_set: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false },
|
|
1135
|
+
sys_user_permission_set: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false },
|
|
1136
|
+
sys_user_role: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false }
|
|
1137
|
+
},
|
|
1138
|
+
systemPermissions: ["manage_org_users", "setup.access"],
|
|
1139
|
+
rowLevelSecurity: [
|
|
1140
|
+
{
|
|
1141
|
+
name: "tenant_isolation",
|
|
1142
|
+
object: "*",
|
|
1143
|
+
operation: "all",
|
|
1144
|
+
using: "organization_id = current_user.organization_id"
|
|
1145
|
+
},
|
|
1146
|
+
// ── better-auth system tables that lack `organization_id` and would
|
|
1147
|
+
// otherwise be denied by the wildcard policy. Same self-only
|
|
1148
|
+
// carve-outs as `member_default` — an org admin does not get to
|
|
1149
|
+
// inspect cross-tenant identity rows.
|
|
1150
|
+
{
|
|
1151
|
+
name: "sys_organization_self",
|
|
1152
|
+
object: "sys_organization",
|
|
1153
|
+
operation: "all",
|
|
1154
|
+
using: "id = current_user.organization_id"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
name: "sys_user_self",
|
|
1158
|
+
object: "sys_user",
|
|
1159
|
+
operation: "select",
|
|
1160
|
+
using: "id = current_user.id"
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
name: "sys_user_org_members",
|
|
1164
|
+
object: "sys_user",
|
|
1165
|
+
operation: "select",
|
|
1166
|
+
using: "id IN (current_user.org_user_ids)"
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
name: "sys_session_self",
|
|
1170
|
+
object: "sys_session",
|
|
1171
|
+
operation: "all",
|
|
1172
|
+
using: "user_id = current_user.id"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
name: "sys_account_self",
|
|
1176
|
+
object: "sys_account",
|
|
1177
|
+
operation: "select",
|
|
1178
|
+
using: "user_id = current_user.id"
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
name: "sys_team_member_self",
|
|
1182
|
+
object: "sys_team_member",
|
|
1183
|
+
operation: "select",
|
|
1184
|
+
using: "user_id = current_user.id"
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
name: "sys_two_factor_self",
|
|
1188
|
+
object: "sys_two_factor",
|
|
1189
|
+
operation: "all",
|
|
1190
|
+
using: "user_id = current_user.id"
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
name: "sys_user_preference_self",
|
|
1194
|
+
object: "sys_user_preference",
|
|
1195
|
+
operation: "all",
|
|
1196
|
+
using: "user_id = current_user.id"
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
name: "sys_api_key_self",
|
|
1200
|
+
object: "sys_api_key",
|
|
1201
|
+
operation: "all",
|
|
1202
|
+
using: "user_id = current_user.id"
|
|
1203
|
+
},
|
|
1204
|
+
{
|
|
1205
|
+
name: "sys_device_code_self",
|
|
1206
|
+
object: "sys_device_code",
|
|
1207
|
+
operation: "all",
|
|
1208
|
+
using: "user_id = current_user.id"
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
name: "sys_oauth_access_token_self",
|
|
1212
|
+
object: "sys_oauth_access_token",
|
|
1213
|
+
operation: "select",
|
|
1214
|
+
using: "user_id = current_user.id"
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
name: "sys_oauth_refresh_token_self",
|
|
1218
|
+
object: "sys_oauth_refresh_token",
|
|
1219
|
+
operation: "select",
|
|
1220
|
+
using: "user_id = current_user.id"
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
name: "sys_oauth_consent_self",
|
|
1224
|
+
object: "sys_oauth_consent",
|
|
1225
|
+
operation: "all",
|
|
1226
|
+
using: "user_id = current_user.id"
|
|
1227
|
+
},
|
|
1228
|
+
// OAuth applications a user has registered themselves (self-service
|
|
1229
|
+
// developer flow exposed in the Account app's Developer section).
|
|
1230
|
+
// `sys_oauth_application` has no `organization_id` so the wildcard
|
|
1231
|
+
// `tenant_isolation` policy would otherwise deny every row.
|
|
1232
|
+
{
|
|
1233
|
+
name: "sys_oauth_application_self",
|
|
1234
|
+
object: "sys_oauth_application",
|
|
1235
|
+
operation: "all",
|
|
1236
|
+
using: "user_id = current_user.id"
|
|
1237
|
+
},
|
|
1238
|
+
// Org-scoped visibility for organization-owned identity-adjacent
|
|
1239
|
+
// tables. Org admins may inspect their own org's invitations and
|
|
1240
|
+
// memberships (read; writes still flow through better-auth).
|
|
1241
|
+
{
|
|
1242
|
+
name: "sys_member_org",
|
|
1243
|
+
object: "sys_member",
|
|
1244
|
+
operation: "select",
|
|
1245
|
+
using: "organization_id = current_user.organization_id"
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
name: "sys_invitation_org",
|
|
1249
|
+
object: "sys_invitation",
|
|
1250
|
+
operation: "select",
|
|
1251
|
+
using: "organization_id = current_user.organization_id"
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
name: "sys_team_org",
|
|
1255
|
+
object: "sys_team",
|
|
1256
|
+
operation: "select",
|
|
1257
|
+
using: "organization_id = current_user.organization_id"
|
|
1258
|
+
}
|
|
1259
|
+
]
|
|
1063
1260
|
}),
|
|
1064
1261
|
PermissionSetSchema.parse({
|
|
1065
1262
|
name: "member_default",
|
|
@@ -1190,6 +1387,16 @@ var defaultPermissionSets = [
|
|
|
1190
1387
|
object: "sys_oauth_consent",
|
|
1191
1388
|
operation: "all",
|
|
1192
1389
|
using: "user_id = current_user.id"
|
|
1390
|
+
},
|
|
1391
|
+
// OAuth applications a user has registered themselves (Account →
|
|
1392
|
+
// Developer → OAuth Applications). `sys_oauth_application` has no
|
|
1393
|
+
// `organization_id`, so without this carve-out the wildcard
|
|
1394
|
+
// `tenant_isolation` policy returns zero rows even for the owner.
|
|
1395
|
+
{
|
|
1396
|
+
name: "sys_oauth_application_self",
|
|
1397
|
+
object: "sys_oauth_application",
|
|
1398
|
+
operation: "all",
|
|
1399
|
+
using: "user_id = current_user.id"
|
|
1193
1400
|
}
|
|
1194
1401
|
]
|
|
1195
1402
|
}),
|