UNPKG

jsm-core

Version:
16 lines (15 loc) 787 B
import { Request, Response, NextFunction } from "express"; /** * Check if user has permission * - If the request is identified as a service request, always pass * - If user is master, always pass * - If the permission is not passed, pass * - If user has the permission, pass * - If the passed permissions is an array, check if user has one of the permissions * - If the passed permissions is an array of arrays, check if user has all the permissions in one of the arrays * @param {*} req Express req Object * @param {*} res Express res Object * @param {*} next Express next Function */ declare const userHasPermission: (permission: string | (string | string[])[]) => (req: Request, res: Response, next: NextFunction) => Promise<any>; export default userHasPermission;