@ahi40/common
Advanced tools
Comparing version 1.0.75 to 1.0.76
import { Request, Response, NextFunction } from 'express'; | ||
import { UserRoles } from '../rbac/userRoles'; | ||
export declare const validateUserRole: (role: UserRoles) => (req: Request, res: Response, next: NextFunction) => void; | ||
export declare const validateUserRole: (roles: Array<UserRoles>) => (req: Request, res: Response, next: NextFunction) => void; |
@@ -5,7 +5,7 @@ "use strict"; | ||
var not_authorized_error_1 = require("../errors/not-authorized-error"); | ||
exports.validateUserRole = function (role) { | ||
exports.validateUserRole = function (roles) { | ||
return function (req, res, next) { | ||
var _a; | ||
if (((_a = req.currentUser) === null || _a === void 0 ? void 0 : _a.userRole) !== role) { | ||
console.log('failed comp'); | ||
var _a, _b; | ||
if (((_a = req.currentUser) === null || _a === void 0 ? void 0 : _a.userRole) && | ||
!roles.includes((_b = req.currentUser) === null || _b === void 0 ? void 0 : _b.userRole)) { | ||
throw new not_authorized_error_1.NotAuthorizedError(); | ||
@@ -12,0 +12,0 @@ } |
{ | ||
"name": "@ahi40/common", | ||
"version": "1.0.75", | ||
"version": "1.0.76", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30224