Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
)

* [JENKINS-58244] https://issues.jenkins-ci.org/browse/JENKINS-58244

Signed-off-by: olivier lamy <olamy@apache.org>

* move dependency-check-maven:check to a profile as it is just a big pain...

Signed-off-by: olivier lamy <olamy@apache.org>
  • Loading branch information
olamy authored Jun 28, 2019
1 parent bec6405 commit f076bd1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ install:
- mvn clean test-compile -DskipTests=true -Dmaven.javadoc.skip=true --batch-mode -V
after_success:
- mvn coveralls:report --batch-mode
- mvn -P enable-jacoco install jacoco:report --batch-mode
- mvn -P enable-jacoco install jacoco:report --batch-mode -P owasp
- mvn -DskipTests=true verify

before_cache:
Expand Down
31 changes: 19 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@
</plugins>
</build>
</profile>
<profile>
<id>owasp</id>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${owasp.version}</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<scm>
Expand Down Expand Up @@ -153,18 +172,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${owasp.version}</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- spotbugs is defined in parent plugin-pom but overriding some things here -->
<plugin>
<groupId>com.github.spotbugs</groupId>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/hudson/plugins/jira/JiraSite.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import hudson.plugins.jira.model.JiraIssue;
import hudson.security.ACL;
import hudson.security.AccessControlled;
import hudson.security.Permission;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import hudson.util.Secret;
Expand Down Expand Up @@ -1201,7 +1202,7 @@ public FormValidation doValidate(@QueryParameter String url,

public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String url) {
AccessControlled _context = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
if (_context == null || !_context.hasPermission(Jenkins.ADMINISTER)) {
if (_context == null || !_context.hasPermission(Item.CONFIGURE)) {
return new StandardUsernameListBoxModel();
}

Expand Down
5 changes: 5 additions & 0 deletions src/test/java/hudson/plugins/jira/DescriptorImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void doFillCredentialsIdItems() throws IOException {
MockAuthorizationStrategy as = new MockAuthorizationStrategy();
as.grant(Jenkins.ADMINISTER).everywhere().to("admin");
as.grant(Item.READ).onItems(dummy).to("alice");
as.grant(Item.CONFIGURE).onItems(dummy).to("dev");
r.jenkins.setAuthorizationStrategy(as);

try (ACLContext ignored = ACL.as(User.get("admin"))) {
Expand All @@ -102,6 +103,10 @@ public void doFillCredentialsIdItems() throws IOException {
ListBoxModel options = r.jenkins.getDescriptorByType(JiraSite.DescriptorImpl.class).doFillCredentialsIdItems(dummy, "http://example.org");
assertThat(options, empty());
}
try (ACLContext ignored = ACL.as(User.get("dev"))) {
ListBoxModel options = r.jenkins.getDescriptorByType(JiraSite.DescriptorImpl.class).doFillCredentialsIdItems(dummy, "http://example.org");
assertThat(options, hasSize(2));
}
}

}

0 comments on commit f076bd1

Please sign in to comment.