@fonderie/workspaces 6.0.1 → 6.0.2
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/index.cjs +19 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1358,6 +1358,25 @@ function invitationController(store, ttl, bus) {
|
|
|
1358
1358
|
return setApiResponse6(HTTP6.SERVER_ERROR, "SERVER_ERROR", "Default role not found");
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
+
const explicitRoleIds = [...new Set(
|
|
1362
|
+
entries.map((e) => e["roleId"]).filter((r) => typeof r === "string")
|
|
1363
|
+
)];
|
|
1364
|
+
if (explicitRoleIds.length > 0) {
|
|
1365
|
+
const rows = await store.query(
|
|
1366
|
+
`SELECT id FROM fonderie_roles
|
|
1367
|
+
WHERE id = ANY($1) AND workspace_id = $2 AND is_system = false`,
|
|
1368
|
+
[explicitRoleIds, ctx.workspace.id]
|
|
1369
|
+
);
|
|
1370
|
+
const assignable = new Set(rows.map((r) => r.id));
|
|
1371
|
+
const bad = explicitRoleIds.find((id) => !assignable.has(id));
|
|
1372
|
+
if (bad) {
|
|
1373
|
+
return setApiResponse6(
|
|
1374
|
+
HTTP6.UNPROCESSABLE,
|
|
1375
|
+
"INVALID_ROLE",
|
|
1376
|
+
"Role is not assignable in this workspace."
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1361
1380
|
const results = await Promise.all(
|
|
1362
1381
|
entries.map(async (entry) => {
|
|
1363
1382
|
const email2 = entry["email"];
|