mirror of
https://github.com/zoriya/flood.git
synced 2026-08-15 18:53:27 +00:00
Otherwise zod will be included in client dependency graph and increase the bundle size by 10kB unnecessarily.
12 lines
367 B
TypeScript
12 lines
367 B
TypeScript
import type {Request, Response, NextFunction} from 'express';
|
|
|
|
import {AccessLevel} from '../../shared/schema/constants/Auth';
|
|
|
|
export default (req: Request, res: Response, next: NextFunction) => {
|
|
if (req.user == null || req.user.level !== AccessLevel.ADMINISTRATOR) {
|
|
res.status(403).json({message: 'User is not admin.'}).send();
|
|
return;
|
|
}
|
|
next();
|
|
};
|