Search in sources :

Example 1 with User

use of cz.metacentrum.perun.openapi.model.User in project perun by CESNET.

the class ListOfVoMembersWithCertificate method executeCommand.

@Override
public void executeCommand(PerunCLI.CommandContext ctx) {
    Integer voId = this.getVoId(ctx, true);
    AttributesManagerApi attributesManager = ctx.getPerunRPC().getAttributesManager();
    int prefDNid = attributesManager.getAttributeDefinitionByName("urn:perun:user:attribute-def:def:userPreferredCertDN").getId();
    for (Member member : ctx.getPerunRPC().getMembersManager().getMembers(voId, null)) {
        String pdn = (String) attributesManager.getUserAttributeById(member.getUserId(), prefDNid).getValue();
        if (pdn != null) {
            User user = ctx.getPerunRPC().getUsersManager().getUserById(member.getUserId());
            System.out.println(user.getFirstName() + " " + user.getLastName() + " (" + member.getStatus() + ") " + pdn);
        }
    }
}
Also used : AttributesManagerApi(cz.metacentrum.perun.openapi.AttributesManagerApi) User(cz.metacentrum.perun.openapi.model.User) Member(cz.metacentrum.perun.openapi.model.Member)

Aggregations

AttributesManagerApi (cz.metacentrum.perun.openapi.AttributesManagerApi)1 Member (cz.metacentrum.perun.openapi.model.Member)1 User (cz.metacentrum.perun.openapi.model.User)1