File tree Expand file tree Collapse file tree
src/main/java/io/jenkins/plugins/gitlabserverconfig/servers Expand file tree Collapse file tree Original file line number Diff line number Diff 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+ context .checkPermission (CredentialsProvider .USE_OWN );
343350 if (context instanceof ItemGroup ) {
344351 return StringUtils .isBlank (webhookSecretCredentialsId )
345352 ? null
You can’t perform that action at this time.
0 commit comments