Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
buildPlugin(useContainerAgent: true,
configurations: [
[platform: 'linux', jdk: 11],
[platform: 'windows', jdk: 11],
[platform: 'linux', jdk: 17],
[platform: 'linux', jdk: 21]
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
])
10 changes: 6 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.5</version>
</parent>
<artifactId>matrix-auth</artifactId>
<version>${revision}${changelist}</version>
Expand All @@ -28,16 +28,18 @@
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<hpi.compatibleSinceVersion>3.2</hpi.compatibleSinceVersion>
<jenkins.version>2.426.3</jenkins.version>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<spotless.check.skip>false</spotless.check.skip>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.426.x</artifactId>
<version>3208.vb_21177d4b_cd9</version>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3893.v213a_42768d35</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.verb.GET;

/**
Expand Down Expand Up @@ -167,7 +167,7 @@ public PermissionScope getPermissionScope() {
}

@Override
public AuthorizationMatrixProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException {
public AuthorizationMatrixProperty newInstance(StaplerRequest2 req, JSONObject formData) throws FormException {
return createNewInstance(req, formData, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.verb.GET;

/**
Expand Down Expand Up @@ -205,7 +205,7 @@ public PermissionScope getPermissionScope() {
}

@Override
public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) throws FormException {
public JobProperty<?> newInstance(StaplerRequest2 req, JSONObject formData) throws FormException {
return createNewInstance(req, formData, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* Role-based authorization via a matrix.
Expand Down Expand Up @@ -162,7 +162,7 @@ public String getDisplayName() {
}

@Override
public AuthorizationStrategy newInstance(StaplerRequest req, @NonNull JSONObject formData)
public AuthorizationStrategy newInstance(StaplerRequest2 req, @NonNull JSONObject formData)
throws FormException {
// TODO Is there a way to pull this up into AuthorizationContainerDescriptor and share code with
// AuthorizationPropertyDescriptor?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

public class AuthorizationMatrixNodeProperty extends NodeProperty<Node> implements AuthorizationProperty {

Expand Down Expand Up @@ -164,7 +164,7 @@ public PermissionScope getPermissionScope() {
}

@Override
public AuthorizationMatrixNodeProperty newInstance(StaplerRequest req, @NonNull JSONObject formData)
public AuthorizationMatrixNodeProperty newInstance(StaplerRequest2 req, @NonNull JSONObject formData)
throws FormException {
return createNewInstance(req, formData, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.jenkinsci.plugins.matrixauth;

import hudson.Util;
import hudson.model.Descriptor;
import hudson.security.Permission;
import hudson.security.ProjectMatrixAuthorizationStrategy;
Expand All @@ -35,6 +36,7 @@
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* Interface with default methods common to all authorization related property descriptors.
Expand All @@ -48,8 +50,34 @@

T create();

default T createNewInstance(StaplerRequest2 req, JSONObject formData, boolean hasOptionalWrap)
throws Descriptor.FormException {
if (Util.isOverridden(

Check warning on line 55 in src/main/java/org/jenkinsci/plugins/matrixauth/AuthorizationPropertyDescriptor.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 55 is only partially covered, one branch is missing
AuthorizationPropertyDescriptor.class,
getClass(),
"createNewInstance",
StaplerRequest.class,
JSONObject.class,
boolean.class)) {
return createNewInstance(
req != null ? StaplerRequest.fromStaplerRequest2(req) : null, formData, hasOptionalWrap);

Check warning on line 63 in src/main/java/org/jenkinsci/plugins/matrixauth/AuthorizationPropertyDescriptor.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 62-63 are not covered by tests
} else {
return createNewInstanceImpl(req, formData, hasOptionalWrap);
}
}

/**
* @deprecated use {@link #createNewInstance(StaplerRequest2, JSONObject, boolean)}
*/
@Deprecated
default T createNewInstance(StaplerRequest req, JSONObject formData, boolean hasOptionalWrap)
throws Descriptor.FormException {
return createNewInstanceImpl(
req != null ? StaplerRequest.toStaplerRequest2(req) : null, formData, hasOptionalWrap);

Check warning on line 76 in src/main/java/org/jenkinsci/plugins/matrixauth/AuthorizationPropertyDescriptor.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 75-76 are not covered by tests
}

private T createNewInstanceImpl(StaplerRequest2 req, JSONObject formData, boolean hasOptionalWrap)
throws Descriptor.FormException {
if (hasOptionalWrap) {
formData = formData.getJSONObject("useProjectSecurity");
if (formData.isNullObject()) return null;
Expand Down
Loading