/** * Creates a new instance of the GitLabUserInformation object containing information about the logged in user. * * @return the UserPropery object */ @Override public UserProperty newInstance(User user) { Authentication auth = Jenkins.getAuthentication(); if (auth instanceof GitLabUserDetails) { GitLabUserInfo gitLabUser; try { gitLabUser = GitLab.getUser(((GitLabUserDetails) auth.getPrincipal()).getId()); return new GitLabUserProperty(gitLabUser); } catch (GitLabApiException e) { LOGGER.warning(e.getMessage()); } } return new GitLabUserProperty(); }
public TestGitRepo(String name, File tmpDir, TaskListener listener) throws IOException, InterruptedException { this.name = name; this.listener = listener; envVars = new EnvVars(); gitDir = tmpDir; User john = User.get(johnDoe.getName(), true); UserProperty johnsMailerProperty = new Mailer.UserProperty(johnDoe.getEmailAddress()); john.addProperty(johnsMailerProperty); User jane = User.get(janeDoe.getName(), true); UserProperty janesMailerProperty = new Mailer.UserProperty(janeDoe.getEmailAddress()); jane.addProperty(janesMailerProperty); // initialize the git interface. gitDirPath = new FilePath(gitDir); git = Git.with(listener, envVars).in(gitDir).getClient(); // finally: initialize the repo git.init(); }
@Override public UserProperty newInstance(User user) { return new RRHudsonUserProperty(); }
@Override public UserProperty newInstance(User user) { return new PreferredProviderUserProperty(ProviderOption.DEFAULT_OPTION.getId()); }
@Override public UserProperty reconfigure(StaplerRequest red, net.sf.json.JSONObject form) throws Descriptor.FormException { return this; }
@Override public UserProperty newInstance(User user) { return new P4UserProperty(null); }
@Override public UserProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException { return new P4UserProperty(formData.optString("email")); }