godcrm/backend/routes/v3/system/helpers.js
GOD CRM Release f89e074dd1
Some checks failed
CI / Lint / Typecheck / Test / Build (push) Has been cancelled
CI / PostgreSQL Integration Tests (push) Has been cancelled
GOD CRM — public scrubbed snapshot
Governed substrate for autonomous agents: scoped identity (passports),
audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
2026-08-10 04:01:45 +03:00

23 lines
592 B
JavaScript

// system/helpers.js — Shared middleware for system routes
import { forbidden } from '../../../utils/response.js';
/**
* Middleware to check if user is owner
*/
export const ownerOnly = (req, res, next) => {
if (req.user?.role !== 'owner') {
return forbidden(res, 'Only owner can access system settings');
}
next();
};
/**
* Middleware to check if user is owner or admin
*/
export const adminOrOwner = (req, res, next) => {
if (req.user?.role !== 'owner' && req.user?.role !== 'admin') {
return forbidden(res, 'Only admin or owner can access this');
}
next();
};