Java Code Examples for hudson.model.User#getDisplayName()

The following examples show how to use hudson.model.User#getDisplayName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GitReadSaveService.java    From blueocean-plugin with MIT License 6 votes vote down vote up
@Nonnull
protected StandardUsernamePasswordCredentials getCredentialForUser(@Nonnull Item item, @Nonnull String repositoryUrl) {

    User user = User.current();
    if (user == null) { //ensure this session has authenticated user
        throw new ServiceException.UnauthorizedException("No logged in user found");
    }

    String credentialId = GitScm.makeCredentialId(repositoryUrl);
    StandardUsernamePasswordCredentials credential = null;

    if (credentialId != null) {
        credential = CredentialsUtils.findCredential(credentialId,
                                        StandardUsernamePasswordCredentials.class,
                                        new BlueOceanDomainRequirement());
    }

    if (credential == null) {
        throw new ServiceException.UnauthorizedException("No credential found for " + credentialId + " for user " + user.getDisplayName());
    }

    return credential;
}
 
Example 2
Source File: MavenDependencyCliCause.java    From pipeline-maven-plugin with MIT License 4 votes vote down vote up
@Override
public String getShortDescription() {
    User user = User.get(startedBy, false, Collections.emptyMap());
    String userName = user != null ? user.getDisplayName() : startedBy;
    return "Started from command line by " + userName + " for maven artifacts " + getMavenArtifactsDescription();
}