Skip to content

Commit dee7766

Browse files
authored
[JENKINS-70746] Fix missing permission error when processing changes (#288)
1 parent b9560d6 commit dee7766

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/io/jenkins/plugins/gitlabserverconfig/servers/GitLabServer.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
88
import com.cloudbees.plugins.credentials.common.StandardCredentials;
99
import com.cloudbees.plugins.credentials.common.StandardListBoxModel;
10+
import com.cloudbees.plugins.credentials.domains.DomainRequirement;
1011
import edu.umd.cs.findbugs.annotations.CheckForNull;
1112
import edu.umd.cs.findbugs.annotations.NonNull;
1213
import hudson.Extension;
@@ -24,6 +25,7 @@
2425
import java.net.MalformedURLException;
2526
import java.net.URL;
2627
import java.security.SecureRandom;
28+
import java.util.ArrayList;
2729
import java.util.Collections;
2830
import java.util.List;
2931
import java.util.logging.Level;
@@ -374,9 +376,12 @@ public Secret getSecretToken() {
374376

375377
private StringCredentials getWebhookSecretCredentials(String webhookSecretCredentialsId) {
376378
Jenkins jenkins = Jenkins.get();
377-
jenkins.checkPermission(Jenkins.ADMINISTER);
378-
return StringUtils.isBlank(webhookSecretCredentialsId) ? null : CredentialsMatchers.firstOrNull(
379-
lookupCredentials(StringCredentials.class, jenkins),
379+
return StringUtils.isBlank(webhookSecretCredentialsId) ? null
380+
: CredentialsMatchers.firstOrNull(lookupCredentials(
381+
StringCredentials.class,
382+
jenkins,
383+
ACL.SYSTEM,
384+
new ArrayList<DomainRequirement>()),
380385
withId(webhookSecretCredentialsId)
381386
);
382387
}

0 commit comments

Comments
 (0)