// Package on purpose
static final String NAME="Approvals";
static final String HREF = "/gui/approve";
- static final String[] FIELDS = new String[] {"line[]","user","delegate_of"};
+ static final String[] FIELDS = new String[] {"line[]","user","delegate_of","as_user"};
public ApprovalForm(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
private static final String[] headers = new String[] {"Identity","Request","Approve","Deny"};
private Slot sUser;
private Slot sAsDelegate;
+ private Slot sAsUser;
public Model(AuthzEnv env) {
sUser = env.slot(NAME+".user");
sAsDelegate = env.slot(NAME+".delegate_of");
+ sAsUser = env.slot(NAME + ".as_user");
}
@Override
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final String userParam = trans.get(sUser, null);
- final String asDelegate = trans.get(sAsDelegate, trans.user());
+
+ final String asDelegate = trans.get(sAsDelegate, null);
+ final String approver;
+ if(asDelegate==null) {
+ approver = trans.get(sAsUser,trans.user());
+ } else {
+ approver = asDelegate;
+ }
+
ArrayList<AbsCell[]> rv = new ArrayList<>();
String msg = null;
TimeTaken tt = trans.start("AAF Get Approvals for Approver",Env.REMOTE);
int numLeft = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Integer>() {
@Override
public Integer code(Rcli<?> client) throws CadiException, ConnectException, APIException {
- Future<Approvals> fa = client.read("/authz/approval/approver/"+asDelegate,gui.getDF(Approvals.class));
+ Future<Approvals> fa = client.read("/authz/approval/approver/"+approver,gui.getDF(Approvals.class));
int numLeft = 0;
if (fa.get(AAF_GUI.TIMEOUT)) {
userCell = new TextToolTipCell(user,title);
}
}
- prevUser=user;
// userCell = new RefCell(prevUser,
// TODO_ILM_INFO+user.substring(0, user.length()-domainOfApprover.length()),
// true,
} else {
userCell = new TextCell(prevUser==null?user:prevUser);
}
+ prevUser=user;
AbsCell[] sa = new AbsCell[] {
userCell,
new TextCell(appr.getMemo()),