Add GET /user/:id/punishments

This commit is contained in:
Colin McDonald 2016-06-17 01:11:45 -04:00
parent 15a8ba70db
commit c830372f29
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package net.frozenorb.apiv3.route.users;
import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
import net.frozenorb.apiv3.APIv3;
import net.frozenorb.apiv3.model.Punishment;
import net.frozenorb.apiv3.model.User;
import net.frozenorb.apiv3.util.ErrorUtils;
public final class GETUserPermissions implements Handler<RoutingContext> {
public void handle(RoutingContext ctx) {
User target = User.findByIdSync(ctx.request().getParam("id"));
if (target == null) {
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
return;
}
APIv3.respondJson(ctx, target.getGlobalPermissions());
}
}