use of cz.metacentrum.perun.openapi.model.Member in project perun by CESNET.
the class GetExpirationByExtLogin method executeCommand.
@Override
public void executeCommand(PerunCLI.CommandContext ctx) {
String extSourceName = ctx.getCommandLine().getOptionValue("E");
Integer voId = getVoId(ctx, true);
String filename = ctx.getCommandLine().getOptionValue("f");
try {
PerunRPC perunRPC = ctx.getPerunRPC();
for (String login : Files.readAllLines(Paths.get(filename))) {
Member member = perunRPC.getMembersManager().getMemberByExtSourceNameAndExtLogin(voId, login, extSourceName);
Attribute attr = perunRPC.getAttributesManager().getMemberAttributeByName(member.getId(), "urn:perun:member:attribute-def:def:membershipExpiration");
String expiration = (String) attr.getValue();
System.out.println(login + ";" + expiration);
}
} catch (IOException e) {
System.err.println("file " + filename + " cannot be read");
System.exit(1);
}
}
use of cz.metacentrum.perun.openapi.model.Member 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);
}
}
}
Aggregations