diff --git a/src/middleware/auth.js b/src/middleware/auth.js index 3449617..3594f40 100644 --- a/src/middleware/auth.js +++ b/src/middleware/auth.js @@ -1,6 +1,5 @@ import { asyncHandler } from '@sliit-foss/functions'; import { default as createError } from 'http-errors'; -import { ROLE } from '@/constants'; import { isBlacklistedToken } from '@/repository/token'; import { getOneUser } from '@/repository/user'; import { decodeJwtToken } from '@/utils'; @@ -24,11 +23,6 @@ export const protect = asyncHandler(async (req) => { req.user = user; }); -export const adminProtect = asyncHandler((req) => { - if (req.headers['x-api-key'] === process.env.API_ACCESS_KEY) return; - if (req.user?.role !== ROLE.ADMIN) throw new createError(403, 'You are not permitted to access this resource'); -}); - export const roleProtect = (roles = []) => { return asyncHandler((req) => { if (req.headers['x-api-key'] === process.env.API_ACCESS_KEY) return;