File tree Expand file tree Collapse file tree 1 file changed +0
-6
lines changed Expand file tree Collapse file tree 1 file changed +0
-6
lines changed Original file line number Diff line number Diff line change 11import { asyncHandler } from '@sliit-foss/functions' ;
22import { default as createError } from 'http-errors' ;
3- import { ROLE } from '@/constants' ;
43import { isBlacklistedToken } from '@/repository/token' ;
54import { getOneUser } from '@/repository/user' ;
65import { decodeJwtToken } from '@/utils' ;
@@ -24,11 +23,6 @@ export const protect = asyncHandler(async (req) => {
2423 req . user = user ;
2524} ) ;
2625
27- export const adminProtect = asyncHandler ( ( req ) => {
28- if ( req . headers [ 'x-api-key' ] === process . env . API_ACCESS_KEY ) return ;
29- if ( req . user ?. role !== ROLE . ADMIN ) throw new createError ( 403 , 'You are not permitted to access this resource' ) ;
30- } ) ;
31-
3226export const roleProtect = ( roles = [ ] ) => {
3327 return asyncHandler ( ( req ) => {
3428 if ( req . headers [ 'x-api-key' ] === process . env . API_ACCESS_KEY ) return ;
You can’t perform that action at this time.
0 commit comments