Skip to content

Commit af123a6

Browse files
committed
Migrate UpdateSiteWarningsMonitor
1 parent f98cf81 commit af123a6

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

core/src/main/java/jenkins/security/UpdateSiteWarningsMonitor.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.kohsuke.accmod.Restricted;
4343
import org.kohsuke.accmod.restrictions.NoExternalUse;
4444
import org.kohsuke.stapler.HttpResponse;
45-
import org.kohsuke.stapler.QueryParameter;
4645
import org.kohsuke.stapler.interceptor.RequirePOST;
4746

4847
/**
@@ -144,17 +143,15 @@ private Set<UpdateSite.Warning> getActiveWarnings() {
144143
* Redirects the user to the plugin manager or security configuration
145144
*/
146145
@RequirePOST
147-
public HttpResponse doForward(@QueryParameter String fix, @QueryParameter String configure) {
146+
public HttpResponse doFix() {
148147
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
149-
if (fix != null) {
150-
return HttpResponses.redirectViaContextPath("pluginManager");
151-
}
152-
if (configure != null) {
153-
return HttpResponses.redirectViaContextPath("configureSecurity");
154-
}
148+
return HttpResponses.redirectViaContextPath("pluginManager");
149+
}
155150

156-
// shouldn't happen
157-
return HttpResponses.redirectViaContextPath("/");
151+
@RequirePOST
152+
public HttpResponse doConfigure() {
153+
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
154+
return HttpResponses.redirectViaContextPath("configureSecurity");
158155
}
159156

160157
/**

core/src/main/resources/jenkins/security/UpdateSiteWarningsMonitor/message.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def pluginWarnings = my.activePluginWarningsByPlugin
6767
div(class: "jenkins-alert jenkins-alert-danger", role: "alert") {
6868

6969
l.isAdmin() {
70-
form(method: "post", action: "${rootURL}/${my.url}/forward") {
70+
form(method: "post") {
7171
if (!pluginWarnings.isEmpty()) {
72-
f.submit(name: 'fix', value: _("pluginManager.link"))
72+
f.submit(value: _("pluginManager.link"), action: "${rootURL}/${my.url}/fix")
7373
}
74-
f.submit(name: 'configure', value: _("configureSecurity.link"))
74+
f.submit(value: _("configureSecurity.link"), action: "${rootURL}/${my.url}/configure")
7575
}
7676
}
7777

0 commit comments

Comments
 (0)