tududi/backend/services/rolesService.js
antanst e58ea08b7b Introduce RBAC scaffolding (roles, permissions, actions) and admin/shares endpoints.
Adds initial models, migrations, and services to support role-based access and sharing; wires routes to prepare for permission-driven features.
2025-09-22 15:20:46 +03:00

9 lines
238 B
JavaScript

const { Role } = require('../models');
async function isAdmin(userId) {
if (!userId) return false;
const role = await Role.findOne({ where: { user_id: userId } });
return !!(role && role.is_admin);
}
module.exports = { isAdmin };