Permalink
Browse files

[FIXED JENKINS-29805] fall back to ADMINSTER permission to list avail…

…able Credentials for current user
  • Loading branch information...
imod committed Aug 6, 2015
1 parent 9d79057 commit a186216d09ed6192ddf8edb6a9b6d6702809bbb1
@@ -15,6 +15,7 @@
import hudson.model.Descriptor;
import hudson.model.Item;
import hudson.util.ListBoxModel;
import jenkins.model.Jenkins;

public class ServerCredentialMapping extends AbstractDescribableImpl<ServerCredentialMapping> {

@@ -45,11 +46,12 @@ public String getCredentialsId() {
public static class DescriptorImpl extends Descriptor<ServerCredentialMapping> {

public ListBoxModel doFillCredentialsIdItems(@AncestorInPath AbstractProject<?, ?> context, @QueryParameter String serverId) {
if (context == null || !context.hasPermission(Item.CONFIGURE)) {
return new ListBoxModel();
if ( (context == null && Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER))
|| (context != null && context.hasPermission(Item.CONFIGURE)) ) {
final List<StandardUsernameCredentials> validCredentials = CredentialsHelper.findValidCredentials(serverId);
return new StandardUsernameListBoxModel().withEmptySelection().withAll(validCredentials);
}
final List<StandardUsernameCredentials> validCredentials = CredentialsHelper.findValidCredentials(serverId);
return new StandardUsernameListBoxModel().withEmptySelection().withAll(validCredentials);
return new ListBoxModel();
}

@Override

1 comment on commit a186216

@KostyaSha

This comment has been minimized.

Copy link
Member

KostyaSha commented on a186216 Aug 18, 2015

This issue is blocker, please do release.

Please sign in to comment.