@fonderie/workspaces 6.0.0 → 6.0.1

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.
@@ -15,6 +15,7 @@ new WorkspacesModule(store: IStoreAdapter, config?: IWorkspacesConfig, bus?: Eve
15
15
  interface IWorkspacesConfig {
16
16
  invitationTtl?: string;
17
17
  management?: 'owner-or-admin' | 'any-member';
18
+ managerRoles?: string[];
18
19
  personalWorkspace?: boolean;
19
20
  routes?: Partial<Record<WorkspaceRouteId, WorkspaceRouteOverride>>;
20
21
  }
package/dist/index.cjs CHANGED
@@ -468,6 +468,7 @@ function withWorkspace(store, ctx, next) {
468
468
  // src/middlewares/require-manager.ts
469
469
  var import_core2 = require("@fonderie/core");
470
470
  function requireManager(store, config) {
471
+ const managerRoles = config.managerRoles ?? ["ADMIN"];
471
472
  return async (ctx, next) => {
472
473
  if (config.management === "any-member") return next();
473
474
  if (!ctx.user) {
@@ -486,8 +487,9 @@ function requireManager(store, config) {
486
487
  AND ruw.suspended = false
487
488
  AND r.is_system = true
488
489
  AND r.active = true
490
+ AND r.name = ANY($3)
489
491
  LIMIT 1`,
490
- [ctx.user.id, ctx.workspace.id]
492
+ [ctx.user.id, ctx.workspace.id, managerRoles]
491
493
  );
492
494
  if (!row) {
493
495
  return (0, import_core2.setApiResponse)(