Add GET /user/:id/punishments
This commit is contained in:
parent
15a8ba70db
commit
c830372f29
@ -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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user