diff options
author | Pawel <pawel.kasperkiewicz@nokia.com> | 2018-05-23 05:25:28 -0400 |
---|---|---|
committer | Pawel <pawel.kasperkiewicz@nokia.com> | 2018-05-23 05:59:42 -0400 |
commit | 234c7abfecadf453f14660e3ef4b59a01b75d859 (patch) | |
tree | 1760a9dd7a8517245e4a3a57818af3a38d517306 /auth/auth-gui/src/main/java | |
parent | 2607c2b2cd427616a8f869c809aff19453212f14 (diff) |
fixes in RolesShow.
Change-Id: Idad587c8d793980e728f1be5eb974e43e9e81f1f
Issue-ID: AAF-321
Signed-off-by: Pawel <pawel.kasperkiewicz@nokia.com>
Diffstat (limited to 'auth/auth-gui/src/main/java')
-rw-r--r-- | auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java index e3f91ba3..80ff9409 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java @@ -73,6 +73,9 @@ public class RolesShow extends Page { */ private static class Model extends TableData<AAF_GUI,AuthzTrans> { private static final String[] headers = new String[] {"Role","Expires","Remediation","Actions"}; + private static final String ROLE = "&role="; + private static final String USER = "?user="; + private static final String CLASS_EXPIRED = "class=expired"; @Override public String[] headers() { @@ -87,24 +90,23 @@ public class RolesShow extends Page { rv = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Cells>() { @Override public Cells code(Rcli<?> client) throws CadiException, ConnectException, APIException { - ArrayList<AbsCell[]> rv = new ArrayList<AbsCell[]>(); + ArrayList<AbsCell[]> rv = new ArrayList<>(); TimeTaken tt = trans.start("AAF Roles by User",Env.REMOTE); try { Future<UserRoles> fur = client.read("/authz/userRoles/user/"+trans.user(),gui.getDF(UserRoles.class)); - if (fur.get(5000)) { - if(fur.value != null) for (UserRole u : fur.value.getUserRole()) { + if (fur.get(5000) && fur.value != null) for (UserRole u : fur.value.getUserRole()) { if(u.getExpires().compare(Chrono.timeStamp()) < 0) { AbsCell[] sa = new AbsCell[] { - new TextCell(u.getRole() + "*", "class=expired"), - new TextCell(new SimpleDateFormat(DATE_TIME_FORMAT).format(u.getExpires().toGregorianCalendar().getTime()),"class=expired"), + new TextCell(u.getRole() + "*", CLASS_EXPIRED), + new TextCell(new SimpleDateFormat(DATE_TIME_FORMAT).format(u.getExpires().toGregorianCalendar().getTime()),CLASS_EXPIRED), new RefCell("Extend", - UserRoleExtend.HREF + "?user="+trans.user()+"&role="+u.getRole(), + UserRoleExtend.HREF+USER+trans.user()+ROLE+u.getRole(), false, - new String[]{"class=expired"}), + new String[]{CLASS_EXPIRED}), new RefCell("Remove", - UserRoleRemove.HREF + "?user="+trans.user()+"&role="+u.getRole(), + UserRoleRemove.HREF+USER +trans.user()+ROLE+u.getRole(), false, - new String[]{"class=expired"}) + new String[]{CLASS_EXPIRED}) }; rv.add(sa); @@ -116,12 +118,11 @@ public class RolesShow extends Page { new TextCell(new SimpleDateFormat(DATE_TIME_FORMAT).format(u.getExpires().toGregorianCalendar().getTime())), AbsCell.Null, new RefCell("Remove", - UserRoleRemove.HREF + "?user="+trans.user()+"&role="+u.getRole(), + UserRoleRemove.HREF+USER+trans.user()+ROLE+u.getRole(), false) }; rv.add(sa); } - } } } finally { |