Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyFault authored Jul 12, 2022
1 parent 28a46ac commit 536a97b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.verb.POST;

import java.io.IOException;
import java.text.ParseException;
Expand Down Expand Up @@ -382,6 +383,7 @@ private XmlFile getOldConfigXml(String timestamp) {
* @param rsp Outgoing StaplerResponse
* @throws IOException If something goes wrong
*/
@POST
public final void doRestore(StaplerRequest req, StaplerResponse rsp) throws IOException {
checkConfigurePermission();
final String timestamp = req.getParameter("timestamp");
Expand Down Expand Up @@ -413,6 +415,7 @@ public final void doForwardToRestoreQuestion(StaplerRequest req, StaplerResponse
rsp.sendRedirect("restoreQuestion?timestamp=" + timestamp);
}

@POST
public final void doDeleteRevision(StaplerRequest req) {
checkDeleteEntryPermission();
final String timestamp = req.getParameter("timestamp");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.verb.POST;

import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
Expand Down Expand Up @@ -463,6 +464,7 @@ private XmlFile getOldConfigXml(String timestamp) {
* @param rsp Outgoing StaplerResponse
* @throws IOException If something goes wrong
*/
@POST
public final void doRestore(StaplerRequest req, StaplerResponse rsp)
throws IOException {
checkConfigurePermission();
Expand Down Expand Up @@ -492,6 +494,7 @@ public final void doForwardToRestoreQuestion(StaplerRequest req,
rsp.sendRedirect("restoreQuestion?timestamp=" + timestamp);
}

@POST
public final void doDeleteRevision(StaplerRequest req, StaplerResponse rsp) {
checkDeleteEntryPermission();
final String timestamp = req.getParameter("timestamp");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.verb.POST;

import javax.servlet.ServletException;
import java.io.ByteArrayInputStream;
Expand Down Expand Up @@ -662,6 +663,7 @@ public boolean checkParameters(String name, String timestamp) {
* @param rsp Outgoing StaplerResponse
* @throws IOException If something goes wrong
*/
@POST
public final void doRestore(StaplerRequest req, StaplerResponse rsp)
throws IOException {
getAccessControlledObject().checkPermission(Item.CONFIGURE);
Expand Down Expand Up @@ -743,6 +745,7 @@ public final void doForwardToRestoreQuestion(StaplerRequest req,
rsp.sendRedirect("restoreQuestion?name=" + name);
}

@POST
public final void doDeleteRevision(StaplerRequest req, StaplerResponse rsp) {
checkDeleteEntryPermission();
final String timestamp = req.getParameter("timestamp");
Expand Down
5 changes: 3 additions & 2 deletions src/main/webapp/deleteRevisionAndTableEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ function removeEntryFromTable(id, timestamp, name, message) {
if (name != null) {
url += "&name=" + name;
}
xmlHttp.open("GET", url, true);
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader(document.head.getAttribute('data-crumb-header'), document.head.getAttribute('data-crumb-value'));
xmlHttp.send(null);
} else {
return false;
}
}
}

0 comments on commit 536a97b

Please sign in to comment.