package su.xserver.iikocon.handler;

import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;

public class AdminHandler {
  public static void requireAdmin(RoutingContext ctx) {
    String role = ctx.session().get("role");
    if (!"admin".equals(role)) {
      ctx.response().setStatusCode(403).end(new JsonObject().put("error", "Admin access required").encode());
      return;
    }
    ctx.next();
  }
}
