public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String currentValue) { if (!(context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance()).hasPermission(Computer.CONFIGURE)) { return new StandardUsernameListBoxModel().includeCurrentValue(currentValue); } return new StandardUsernameListBoxModel().includeMatchingAs( ACL.SYSTEM, context, StandardUsernameCredentials.class, Collections.<DomainRequirement>singletonList(SSHLauncher.SSH_SCHEME), SSHAuthenticator.matcher(Connection.class)).includeCurrentValue(currentValue); }
public ListBoxModel doFillAdminCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String currentValue) { if (!(context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance()).hasPermission(Computer.CONFIGURE)) { return new StandardUsernameListBoxModel().includeCurrentValue(currentValue); } return new StandardUsernameListBoxModel().includeMatchingAs( ACL.SYSTEM, context, StandardUsernameCredentials.class, Collections.<DomainRequirement>singletonList(SSHLauncher.SSH_SCHEME), SSHAuthenticator.matcher(Connection.class)).includeCurrentValue(currentValue); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String credentialsId) { AccessControlled _context = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance()); if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) { return new StandardUsernameListBoxModel() .includeCurrentValue(credentialsId); } return new StandardUsernameListBoxModel() .includeMatchingAs( ACL.SYSTEM, context, StandardUsernameCredentials.class, Collections.singletonList(SSHLauncher.SSH_SCHEME), SSHAuthenticator.matcher(Connection.class) ) .includeCurrentValue(credentialsId); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String credentialsId) { AccessControlled _context = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance()); if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) { return new StandardUsernameListBoxModel() .includeCurrentValue(credentialsId); } return new StandardUsernameListBoxModel() .includeMatchingAs( ACL.SYSTEM, context, StandardUsernameCredentials.class, Collections.<DomainRequirement>singletonList(SSHLauncher.SSH_SCHEME), SSHAuthenticator.matcher(Connection.class) ) .includeCurrentValue(credentialsId); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String host, @QueryParameter String port, @QueryParameter String credentialsId) { AccessControlled _context = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance()); if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) { return new StandardUsernameListBoxModel() .includeCurrentValue(credentialsId); } try { int portValue = Integer.parseInt(port); return new StandardUsernameListBoxModel() .includeMatchingAs( ACL.SYSTEM, Jenkins.getActiveInstance(), StandardUsernameCredentials.class, Collections.<DomainRequirement>singletonList( new HostnamePortRequirement(host, portValue) ), SSHAuthenticator.matcher(Connection.class)) .includeCurrentValue(credentialsId); // always add the current value last in case already present } catch (NumberFormatException ex) { return new StandardUsernameListBoxModel() .includeCurrentValue(credentialsId); } }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath AccessControlled context, @QueryParameter String host, @QueryParameter String port, @QueryParameter String credentialsId) { Jenkins jenkins = Jenkins.getInstance(); if ((context == jenkins && !jenkins.hasPermission(Computer.CREATE)) || (context != jenkins && !context.hasPermission(Computer.CONFIGURE))) { return new StandardUsernameListBoxModel() .includeCurrentValue(credentialsId); } try { int portValue = Integer.parseInt(port); return new StandardUsernameListBoxModel() .includeMatchingAs( ACL.SYSTEM, jenkins, StandardUsernameCredentials.class, Collections.singletonList( new HostnamePortRequirement(host, portValue) ), SSHAuthenticator.matcher(Connection.class)) .includeCurrentValue(credentialsId); // always add the current value last in case already present } catch (NumberFormatException ex) { return new StandardUsernameListBoxModel() .includeCurrentValue(credentialsId); } }