Socket
Socket
Sign inDemoInstall

@ahi40/common

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ahi40/common - npm Package Compare versions

Comparing version 1.0.75 to 1.0.76

2

build/middlewares/validate-user-role.d.ts
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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc