use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval in project OA4MP by ncsa.
the class ClientApprovalStoreCommands method update.
@Override
public boolean update(Identifiable identifiable) {
ClientApproval clientApproval = (ClientApproval) identifiable;
info("Starting update for client approval id=" + identifiable.getIdentifierString());
sayi("Enter the information for the client approval");
clientApproval.setApprover(getInput("name of the approver", clientApproval.getApprover()));
boolean isapproved = isOk(getInput("set approved?", clientApproval.isApproved() ? "y" : "n"));
if (isapproved) {
clientApproval.setApproved(true);
clientApproval.setStatus(ClientApproval.Status.APPROVED);
} else {
clientApproval.setApproved(false);
switch(clientApproval.getStatus()) {
case NONE:
case PENDING:
clientApproval.setStatus(ClientApproval.Status.DENIED);
break;
case APPROVED:
clientApproval.setStatus(ClientApproval.Status.REVOKED);
break;
case REVOKED:
case DENIED:
}
}
sayi("save changes [y/n]?");
if (isOk(readline())) {
say(clientApproval.toString());
return true;
}
sayi("save cancelled");
info("Approval update cancelled for id=" + clientApproval.getIdentifierString());
return false;
}
use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval in project OA4MP by ncsa.
the class ClientApprovalStoreCommands method approve.
public void approve(InputLine inputLine) {
if (showHelp(inputLine)) {
showApproveHelp();
return;
}
ClientApproval ca = (ClientApproval) findItem(inputLine);
approve(ca);
}
use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval in project OA4MP by ncsa.
the class ClientApprovalStoreCommands method longFormat.
@Override
protected void longFormat(Identifiable identifiable) {
ClientApproval clientApproval = (ClientApproval) identifiable;
say("\nApprover:" + clientApproval.getApprover());
say("Identifier:" + clientApproval.getIdentifierString());
say("Approved at:" + clientApproval.getApprovalTimestamp());
say("Is approved? " + clientApproval.isApproved());
say("Status:" + clientApproval.getStatus());
}
use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval in project OA4MP by ncsa.
the class ClientStoreUtil method listAll.
@Override
protected LinkedList<Identifiable> listAll() throws Exception {
say("select the number of the item below:");
ClientApprovalStore cas = getSE().getClientApprovalStore();
Set keys = getStore().keySet();
LinkedList<Identifiable> linkedList = new LinkedList<Identifiable>();
int i = 0;
for (Object key : keys) {
boolean isApproved = false;
ClientApproval ca = (ClientApproval) cas.get(key);
if (ca == null) {
// create a new one
ca = (ClientApproval) cas.create();
ca.setStatus(ClientApproval.Status.NONE);
ca.setApproved(false);
cas.save(ca);
} else {
isApproved = ca.isApproved();
if (isApproved && ca.getStatus() != ClientApproval.Status.APPROVED) {
ca.setStatus(ClientApproval.Status.APPROVED);
}
}
ClientApproval.Status status = ca.getStatus();
String printableStatus = "?";
if (status.equals(ClientApproval.Status.NONE)) {
}
Identifiable x = (Identifiable) getStore().get(key);
linkedList.add(x);
say((i++) + "." + "(" + (isApproved ? "A" : "D") + ") " + x.getIdentifierString());
}
if (linkedList.isEmpty()) {
say("(no entries found)");
}
return linkedList;
}
use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApproval in project OA4MP by ncsa.
the class BaseClientStoreCommands method longFormat.
@Override
protected void longFormat(Identifiable identifiable) {
BaseClient client = (BaseClient) identifiable;
say("Client name=" + (client.getName() == null ? "(no name)" : client.getName()));
sayi("identifier=" + client.getIdentifier());
sayi("email=" + client.getEmail());
sayi("creation timestamp=" + client.getCreationTS());
if (getClientApprovalStore() != null) {
ClientApproval clientApproval = (ClientApproval) getClientApprovalStore().get(client.getIdentifier());
if (clientApproval == null) {
sayi("no approval record exists.");
} else {
if (clientApproval.isApproved()) {
String approver = "(unknown)";
if (clientApproval.getApprover() != null) {
approver = clientApproval.getApprover();
}
sayi("approved by " + approver);
} else {
sayi("not approved");
}
}
}
if (client.getSecret() == null) {
sayi("public key: (none)");
} else {
sayi("public key:");
say(client.getSecret());
}
}
Aggregations