Let POST user leave be used from anywhere
This commit is contained in:
parent
b4b70bafd5
commit
46eda73347
@ -14,18 +14,12 @@ public class POSTUserLeave implements Route {
|
|||||||
@Override
|
@Override
|
||||||
public Object handle(Request req, Response res) throws Exception {
|
public Object handle(Request req, Response res) throws Exception {
|
||||||
User user = User.byId(req.params("id"));
|
User user = User.byId(req.params("id"));
|
||||||
Actor actor = req.attribute("actor");
|
|
||||||
|
|
||||||
if (actor.getType() != ActorType.SERVER) {
|
|
||||||
return ErrorUtils.serverOnly();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return ErrorUtils.notFound("User", req.params("id"));
|
return ErrorUtils.notFound("User", req.params("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
user.leftServer();
|
user.leftServer();
|
||||||
|
|
||||||
APIv3.getDatastore().save(user);
|
APIv3.getDatastore().save(user);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user