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
|
||||
public Object handle(Request req, Response res) throws Exception {
|
||||
User user = User.byId(req.params("id"));
|
||||
Actor actor = req.attribute("actor");
|
||||
|
||||
if (actor.getType() != ActorType.SERVER) {
|
||||
return ErrorUtils.serverOnly();
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
return ErrorUtils.notFound("User", req.params("id"));
|
||||
}
|
||||
|
||||
user.leftServer();
|
||||
|
||||
APIv3.getDatastore().save(user);
|
||||
return user;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user