This commit is contained in:
Kiss Dávid
2026-03-29 11:18:31 +02:00
parent 1ebb2e53a9
commit d55e085741
16 changed files with 4130 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import type { HttpContext } from '@adonisjs/core/http'
import type { NextFn } from '@adonisjs/core/types/http'
export default class AdminMiddleware {
async handle(ctx: HttpContext, next: NextFn) {
const user = ctx.auth.user
if (!user || user.role !== 'admin') {
return ctx.response.forbidden({ message: 'Access denied. Administrators only.' })
}
return next()
}
}