package net.pterodactylus.sone.web;
import net.pterodactylus.sone.data.Reply;
-import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.page.Page.Request.Method;
import net.pterodactylus.util.template.DataProvider;
import net.pterodactylus.util.template.Template;
Reply reply = webInterface.getCore().getReply(replyId);
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
- Sone currentSone = getCurrentSone(request.getToadletContext());
- if (!reply.getSone().equals(currentSone)) {
+ if (!webInterface.getCore().isLocalSone(reply.getSone())) {
throw new RedirectException("noPermission.html");
}
if (request.getHttpRequest().isPartSet("confirmDelete")) {
package net.pterodactylus.sone.web.ajax;
import net.pterodactylus.sone.data.Reply;
-import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.json.JsonObject;
protected JsonObject createJsonObject(Request request) {
String replyId = request.getHttpRequest().getParam("reply");
Reply reply = webInterface.getCore().getReply(replyId);
- Sone currentSone = getCurrentSone(request.getToadletContext());
if (reply == null) {
return createErrorJsonObject("invalid-reply-id");
}
- if (currentSone == null) {
- return createErrorJsonObject("auth-required");
- }
- if (!reply.getSone().equals(currentSone)) {
+ if (!webInterface.getCore().isLocalSone(reply.getSone())) {
return createErrorJsonObject("not-authorized");
}
webInterface.getCore().deleteReply(reply);