use of io.jenkins.blueocean.rest.model.BlueUserPermission in project blueocean-plugin by jenkinsci.
the class UserImpl method getPermission.
@Override
public BlueUserPermission getPermission() {
Authentication authentication = Jenkins.getAuthentication();
String name = authentication.getName();
if (isAnonymous(name)) {
return null;
}
User loggedInUser = User.get(name, false, Collections.EMPTY_MAP);
if (loggedInUser == null) {
return null;
}
// round trip to fetch user and authorizations
if (!loggedInUser.getId().equals(user.getId())) {
return null;
}
return new BlueUserPermission() {
@Override
public boolean isAdministration() {
return isAdmin();
}
@Override
public Map<String, Boolean> getPipelinePermission() {
return UserImpl.this.getPipelinePermissions();
}
@Override
public Map<String, Boolean> getCredentialPermission() {
return UserImpl.this.getCredentialPermissions();
}
};
}
Aggregations