add(new \Slim\Extras\Middleware\FeatherBBAuth()); * */ namespace FeatherBB\Middleware; use FeatherBB\Core\Error; use FeatherBB\Core\Interfaces\User; /** * Middleware to check if user is logged and admin */ class AdminMod { public function __invoke($request, $response, $next) { // Middleware to check if user is allowed to moderate, if he's not redirect to error page. if (!User::isAdminMod()) { throw new Error(__('No permission'), 403); } $response = $next($request, $response); return $response; } }