X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-gui%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fgui%2Fpages%2FRoleDetail.java;h=7b01e8f2c7930683a325eee7109aaaf3a0770ded;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=bfc258bc7b0ee963eb38124bdbf70392f030a9d2;hpb=7e966914050e66219689001ff4ab601a49eef0ac;p=aaf%2Fauthz.git diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java index bfc258bc..7b01e8f2 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -63,7 +63,7 @@ import aaf.v2_0.UserRoles; /** * Detail Page for Permissions - * + * * @author Jonathan * */ @@ -82,7 +82,7 @@ public class RoleDetail extends Page { /** * Implement the table content for Permissions Detail - * + * * @author Jonathan * */ @@ -106,14 +106,18 @@ public class RoleDetail extends Page { public void prefix(final AAF_GUI gui, final AuthzTrans trans, final Cache cache, final HTMLGen hgen) { final String pRole = trans.get(sRoleName, null); Validator v = new Validator(); - v.role(pRole); + if(!v.isNull("Role",pRole).err()) { + if(!pRole.startsWith(trans.user())) { + v.role(pRole); + } + } if (v.err()) { trans.warn().printf("Error in PermDetail Request: %s", v.errs()); return; } - - try { + + try { gui.clientAsUser(trans.getUserPrincipal(), new Retryable() { @Override public Boolean code(Rcli client) throws CadiException, ConnectException, APIException { @@ -130,7 +134,7 @@ public class RoleDetail extends Page { trans.put(sMayWrite,mayWrite); Boolean mayApprove = trans.fish(new AAFPermission(role.getNs(),ACCESS,":role:"+role.getName(),"approve")); trans.put(sMayApprove, mayApprove); - + if (mayWrite || mayApprove) { Mark js = new Mark(); Mark fn = new Mark(); @@ -149,7 +153,7 @@ public class RoleDetail extends Page { "dcb.checked= (d.orig != d.value)" ).end(fn) .end(js); - + Mark mark = new Mark(); hgen.incr(mark,"form","method=post"); trans.put(sMark, mark); @@ -159,7 +163,7 @@ public class RoleDetail extends Page { trans.error().printf("Error calling AAF for Roles in GUI, Role Detail %d: %s",fr.code(),fr.body()); return false; } - + if (fur.get(AAF_GUI.TIMEOUT)) { trans.put(sUserRole, fur.value.getUserRole()); } else { @@ -183,7 +187,7 @@ public class RoleDetail extends Page { final String pRole = trans.get(sRoleName, null); final Role role = trans.get(sRole,null); ArrayList rv = new ArrayList<>(); - + if (role!=null) { boolean mayWrite = trans.get(sMayWrite, false); boolean mayApprove = trans.get(sMayApprove, false); @@ -237,11 +241,11 @@ public class RoleDetail extends Page { } } } - + if (mayApprove) { rv.add(AbsCell.HLINE); - // + // rv.add(new AbsCell[] { new TextCell("Users in Role:","width=25%"), new TextCell("Delete","width=10%"), @@ -252,7 +256,7 @@ public class RoleDetail extends Page { if (userroles!=null) { for (UserRole ur : userroles) { String tag = "userrole"; - + rv.add(new AbsCell[] { AbsCell.Null, new CheckBoxCell(tag+".delete", ur.getUser()), @@ -263,10 +267,10 @@ public class RoleDetail extends Page { } } } - - // History + + // History rv.add(new AbsCell[] { - new RefCell("See History",RoleHistory.HREF + "?role=" + pRole,false) + new RefCell("See History",RoleHistory.HREF + "?role=" + pRole,false,"class=greenbutton") }); } else { rv.add(new AbsCell[]{ @@ -295,5 +299,5 @@ public class RoleDetail extends Page { } } -} +} \ No newline at end of file