diff --git a/src/main/java/hudson/plugins/git/UserRemoteConfig.java b/src/main/java/hudson/plugins/git/UserRemoteConfig.java index a405d18db2..6f1dd6e33b 100644 --- a/src/main/java/hudson/plugins/git/UserRemoteConfig.java +++ b/src/main/java/hudson/plugins/git/UserRemoteConfig.java @@ -149,9 +149,9 @@ public FormValidation doCheckCredentialsId(@AncestorInPath Item project, return FormValidation.ok(); } for (ListBoxModel.Option o : CredentialsProvider - .listCredentials(StandardUsernameCredentials.class, project, project instanceof Queue.Task - ? Tasks.getAuthenticationOf((Queue.Task) project) - : ACL.SYSTEM, + .listCredentialsInItem(StandardUsernameCredentials.class, project, project instanceof Queue.Task + ? Tasks.getAuthenticationOf2((Queue.Task) project) + : ACL.SYSTEM2, GitURIRequirementsBuilder.fromUri(url).build(), GitClient.CREDENTIALS_MATCHER)) { if (Objects.equals(value, o.value)) { @@ -259,7 +259,7 @@ public FormValidation doCheckRefspec(@QueryParameter String name, private static StandardCredentials lookupCredentials(@CheckForNull Item project, String credentialId, String uri) { return (credentialId == null) ? null : CredentialsMatchers.firstOrNull( - CredentialsProvider.lookupCredentials(StandardCredentials.class, project, ACL.SYSTEM, + CredentialsProvider.lookupCredentialsInItem(StandardCredentials.class, project, ACL.SYSTEM2, GitURIRequirementsBuilder.fromUri(uri).build()), CredentialsMatchers.withId(credentialId)); } diff --git a/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java b/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java index d67c897706..aa08eb197c 100644 --- a/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java +++ b/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java @@ -1288,8 +1288,8 @@ private StandardUsernameCredentials getCredentials(@CheckForNull Item context) { } return CredentialsMatchers .firstOrNull( - CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, context, - ACL.SYSTEM, URIRequirementBuilder.fromUri(getRemote()).build()), + CredentialsProvider.lookupCredentialsInItem(StandardUsernameCredentials.class, context, + ACL.SYSTEM2, URIRequirementBuilder.fromUri(getRemote()).build()), CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsId), GitClient.CREDENTIALS_MATCHER)); } diff --git a/src/main/java/jenkins/plugins/git/GitSCMFileSystem.java b/src/main/java/jenkins/plugins/git/GitSCMFileSystem.java index a8998fb229..7e146bc563 100644 --- a/src/main/java/jenkins/plugins/git/GitSCMFileSystem.java +++ b/src/main/java/jenkins/plugins/git/GitSCMFileSystem.java @@ -368,10 +368,10 @@ public SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, @CheckForNull String credentialsId = config.getCredentialsId(); if (credentialsId != null) { StandardCredentials credential = CredentialsMatchers.firstOrNull( - CredentialsProvider.lookupCredentials( + CredentialsProvider.lookupCredentialsInItem( StandardUsernameCredentials.class, owner, - ACL.SYSTEM, + ACL.SYSTEM2, URIRequirementBuilder.fromUri(remote).build() ), CredentialsMatchers.allOf( diff --git a/src/main/java/jenkins/plugins/git/GitSCMSource.java b/src/main/java/jenkins/plugins/git/GitSCMSource.java index a4ecc310bc..894ae2b7f9 100644 --- a/src/main/java/jenkins/plugins/git/GitSCMSource.java +++ b/src/main/java/jenkins/plugins/git/GitSCMSource.java @@ -451,12 +451,12 @@ public FormValidation doCheckCredentialsId(@AncestorInPath Item context, return FormValidation.ok(); } - for (ListBoxModel.Option o : CredentialsProvider.listCredentials( + for (ListBoxModel.Option o : CredentialsProvider.listCredentialsInItem( StandardUsernameCredentials.class, context, context instanceof Queue.Task - ? Tasks.getAuthenticationOf((Queue.Task) context) - : ACL.SYSTEM, + ? Tasks.getAuthenticationOf2((Queue.Task) context) + : ACL.SYSTEM2, URIRequirementBuilder.fromUri(remote).build(), GitClient.CREDENTIALS_MATCHER)) { if (Objects.equals(value, o.value)) { diff --git a/src/main/java/jenkins/plugins/git/GitSCMTelescope.java b/src/main/java/jenkins/plugins/git/GitSCMTelescope.java index 44492fe3cc..9862c34d92 100644 --- a/src/main/java/jenkins/plugins/git/GitSCMTelescope.java +++ b/src/main/java/jenkins/plugins/git/GitSCMTelescope.java @@ -195,10 +195,10 @@ public final SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, SCMRevis String credentialsId = config.getCredentialsId(); if (credentialsId != null) { List urlCredentials = CredentialsProvider - .lookupCredentials(StandardUsernameCredentials.class, owner, + .lookupCredentialsInItem(StandardUsernameCredentials.class, owner, owner instanceof Queue.Task - ? Tasks.getAuthenticationOf((Queue.Task) owner) - : ACL.SYSTEM, URIRequirementBuilder.fromUri(remote).build()); + ? Tasks.getAuthenticationOf2((Queue.Task) owner) + : ACL.SYSTEM2, URIRequirementBuilder.fromUri(remote).build()); credentials = CredentialsMatchers.firstOrNull( urlCredentials, CredentialsMatchers