Skip to content

Commit

Permalink
[FIXED JENKINS-29805] fall back to ADMINSTER permission to list avail…
Browse files Browse the repository at this point in the history
…able Credentials for current user
  • Loading branch information
imod committed Aug 6, 2015
1 parent 9d79057 commit a186216
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -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> {

Expand Down Expand Up @@ -45,11 +46,12 @@ public Descriptor<ServerCredentialMapping> getDescriptor() {
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
Expand Down

1 comment on commit a186216

@KostyaSha
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue is blocker, please do release.

Please sign in to comment.