Skip to content

Commit 4bfc1c0

Browse files
committed
Address comments from original PR
1 parent 099657a commit 4bfc1c0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ public String getCredentialsId() {
274274
*/
275275
public StandardCredentials getCredentials(AccessControlled context) {
276276
Jenkins jenkins = Jenkins.get();
277+
if (context == null) {
278+
jenkins.checkPermission(CredentialsProvider.USE_OWN);
279+
} else {
280+
context.checkPermission(CredentialsProvider.USE_OWN);
281+
}
277282
return StringUtils.isBlank(credentialsId)
278283
? null
279284
: CredentialsMatchers.firstOrNull(
@@ -329,6 +334,7 @@ public String getWebhookSecretCredentialsId() {
329334
public StringCredentials getWebhookSecretCredentials(AccessControlled context) {
330335
Jenkins jenkins = Jenkins.get();
331336
if (context == null) {
337+
jenkins.checkPermission(CredentialsProvider.USE_OWN);
332338
return StringUtils.isBlank(webhookSecretCredentialsId)
333339
? null
334340
: CredentialsMatchers.firstOrNull(
@@ -340,6 +346,7 @@ public StringCredentials getWebhookSecretCredentials(AccessControlled context) {
340346
.build()),
341347
withId(webhookSecretCredentialsId));
342348
} else {
349+
jenkins.checkPermission(CredentialsProvider.USE_OWN);
343350
if (context instanceof ItemGroup) {
344351
return StringUtils.isBlank(webhookSecretCredentialsId)
345352
? null

0 commit comments

Comments
 (0)