Skip to content

Commit

Permalink
Merge pull request #15 from jenkinsci/14-fix-code-scanning-alert-stap…
Browse files Browse the repository at this point in the history
…ler-missing-postrequirepost-annotation

Added POST annotation for Form Validations
  • Loading branch information
mrdailey99 authored Jun 14, 2023
2 parents 193783b + 6fb7b00 commit 6f27f05
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/io/jenkins/plugins/ProvarAutomation.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.verb.POST;

import javax.servlet.ServletException;
import java.io.File;
Expand Down Expand Up @@ -374,6 +375,7 @@ public void setInstallations(ProvarAutomationInstallation... provarAutomationIns
save();
}

@POST
public FormValidation doCheckBuildFile(@QueryParameter String value)
throws IOException, ServletException {
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand All @@ -384,6 +386,7 @@ public FormValidation doCheckBuildFile(@QueryParameter String value)
return FormValidation.validateRequired(value);
}

@POST
public FormValidation doCheckTestPlan(@QueryParameter String value)
throws IOException, ServletException {
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand All @@ -395,6 +398,7 @@ public FormValidation doCheckTestPlan(@QueryParameter String value)
return FormValidation.ok();
}

@POST
public FormValidation doCheckTestFolder(@QueryParameter String value)
throws IOException, ServletException {
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand All @@ -406,6 +410,7 @@ public FormValidation doCheckTestFolder(@QueryParameter String value)
return FormValidation.ok();
}

@POST
public FormValidation doCheckSecretsPassword(@QueryParameter String value)
throws IOException, ServletException {
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand All @@ -417,6 +422,7 @@ public FormValidation doCheckSecretsPassword(@QueryParameter String value)
return FormValidation.ok();
}

@POST
public FormValidation doCheckProjectName(@QueryParameter String value)
throws IOException, ServletException {
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand Down Expand Up @@ -455,6 +461,7 @@ public boolean configure(StaplerRequest req, JSONObject json) throws FormExcepti
public static final SalesforceMetadataCacheSettings defaultSalesforceMetadataCacheSetting = SalesforceMetadataCacheSettings.Reuse;
public static final ResultsPathSettings defaultResultsPathSetting = ResultsPathSettings.Increment;

@POST
public ListBoxModel doFillBrowserItems() {
ListBoxModel items = new ListBoxModel();
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand All @@ -471,6 +478,7 @@ public ListBoxModel doFillBrowserItems() {
return items;
}

@POST
public ListBoxModel doFillSalesforceMetadataCacheSettingItems() {
ListBoxModel items = new ListBoxModel();
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand All @@ -482,6 +490,7 @@ public ListBoxModel doFillSalesforceMetadataCacheSettingItems() {
return items;
}

@POST
public ListBoxModel doFillResultsPathSettingItems() {
ListBoxModel items = new ListBoxModel();
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand Down Expand Up @@ -592,6 +601,7 @@ public List<? extends ToolInstaller> getDefaultInstallers() {
/**
* Checks if the PROVAR_HOME is valid.
*/
@POST
public FormValidation doCheckHome(@QueryParameter File value) {
// this can be used to check the existence of a file on the server, so needs to be protected
if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER))
Expand All @@ -610,6 +620,7 @@ public FormValidation doCheckHome(@QueryParameter File value) {
return FormValidation.ok();
}

@POST
public FormValidation doCheckName(@QueryParameter String value) {
return FormValidation.validateRequired(value);
}
Expand Down

0 comments on commit 6f27f05

Please sign in to comment.