import org.onap.aaf.auth.gui.table.AbsCell;
import org.onap.aaf.auth.gui.table.ButtonCell;
import org.onap.aaf.auth.gui.table.RadioCell;
-import org.onap.aaf.auth.gui.table.RefCell;
import org.onap.aaf.auth.gui.table.TableData;
-import org.onap.aaf.auth.gui.table.TextAndRefCell;
import org.onap.aaf.auth.gui.table.TextCell;
+import org.onap.aaf.auth.gui.table.TextToolTipCell;
import org.onap.aaf.auth.org.Organization;
-import org.onap.aaf.auth.org.OrganizationFactory;
import org.onap.aaf.auth.org.Organization.Identity;
+import org.onap.aaf.auth.org.OrganizationFactory;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.client.Future;
import org.onap.aaf.cadi.client.Rcli;
// 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 {
}
},
new Form(true,new Table<AAF_GUI,AuthzTrans>("Approval Requests", gui.env.newTransNoAvg(),new Model(gui.env),"class=stdform"))
- .preamble("The following requires your Approval to proceed in the AAF System.</p><p class=subtext>Hover on Identity for Name; click for WebPhone; If Deny is the only option, User is no longer valid."),
+ .preamble("The following requires your Approval to proceed in the AAF System.</p><p class=subtext>Hover on Name for Identity; If Deny is the only option, User is no longer valid."),
new NamedCode(false, "selectAlljs") {
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
*/
private static class Model extends TableData<AAF_GUI,AuthzTrans> {
//TODO come up with a generic way to do ILM Info (people page)
- private static final String TODO_ILM_INFO = "TODO: ILM Info";
+// private static final String TODO_ILM_INFO = "TODO: ILM Info";
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)) {
// } else {
approverHeader = new AbsCell[] {
new TextCell("Approvals Delegated to Me by " + iapprover.fullName()
- + '(' + iapprover.id() +')',
+ + '(' + iapprover.id() + ')',
new String[] {"colspan=4", "class=head"})
};
// }
userCell = AbsCell.Null;
} else if (user.endsWith(trans.org().getRealm())){
userOK=true;
-// String title;
+ String title;
Organization org = OrganizationFactory.obtain(trans.env(), user);
if (org==null) {
-// title="";
+ title="";
userCell = new TextCell(user);
} else {
Identity au = org.getIdentity(trans, user);
if (au!=null) {
if(au.isPerson()) {
- userCell = new TextCell(au.fullName() + "\n(" + au.id() + ')');
+ userCell = new TextToolTipCell(au.fullName(),"Identity: " + au.id());
} else {
- userCell = new TextCell(au.fullID());
+ Identity managedBy = au.responsibleTo();
+ if (managedBy==null) {
+ title ="Identity: " + au.type();
+ } else {
+ title="Sponsor: " + managedBy.fullName();
+ }
+ userCell = new TextToolTipCell(au.fullID(),title);
}
-//
-// if ("MECHID".equals(au.type())) {
-// Identity managedBy = au.responsibleTo();
-// if (managedBy==null) {
-// title ="title=" + au.type();
-// } else {
-// title="title=Sponsor is " + managedBy.fullName();
-// }
-// } else {
-// title="title=" + au.fullName();
-// }
} else {
userOK=false;
-// title="title=Not a User at " + org.getName();
- userCell = new TextCell(user);
+ title="Not a User at " + org.getName();
+ 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()),