diff options
Diffstat (limited to 'auth')
-rw-r--r-- | auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java | 61 | ||||
-rw-r--r-- | auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java | 3 |
2 files changed, 34 insertions, 30 deletions
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 37526b86..a4d8bed3 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 @@ -121,35 +121,38 @@ public class RoleDetail extends Page { Future<Roles> fr = client.read("/authz/roles/"+pRole+"?ns",gui.getDF(Roles.class)); Future<UserRoles> fur = client.read("/authz/userRoles/role/"+pRole,gui.getDF(UserRoles.class)); if(fr.get(AAF_GUI.TIMEOUT)) { - Role role = fr.value.getRole().get(0); - trans.put(sRole, role); - Boolean mayWrite = trans.fish(new AAFPermission(role.getNs()+".access",":role:"+role.getName(),"write")); - 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(); - hgen.js(js) - .function(fn,"touchedDesc") - .li("d=document.getElementById('descText');", - "if (d.orig == undefined ) {", - " d.orig = d.value;", - " d.addEventListener('keyup',changedDesc);", - " d.removeEventListener('keypress',touchedDesc);", - "}").end(fn) - .function(fn,"changedDesc") - .li( - "dcb=document.getElementById('descCB');", - "d=document.getElementById('descText');", - "dcb.checked= (d.orig != d.value)" - ).end(fn) - .end(js); - - Mark mark = new Mark(); - hgen.incr(mark,"form","method=post"); - trans.put(sMark, mark); + List<Role> roles = fr.value.getRole(); + if(!roles.isEmpty()) { + Role role = fr.value.getRole().get(0); + trans.put(sRole, role); + Boolean mayWrite = trans.fish(new AAFPermission(role.getNs()+".access",":role:"+role.getName(),"write")); + 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(); + hgen.js(js) + .function(fn,"touchedDesc") + .li("d=document.getElementById('descText');", + "if (d.orig == undefined ) {", + " d.orig = d.value;", + " d.addEventListener('keyup',changedDesc);", + " d.removeEventListener('keypress',touchedDesc);", + "}").end(fn) + .function(fn,"changedDesc") + .li( + "dcb=document.getElementById('descCB');", + "d=document.getElementById('descText');", + "dcb.checked= (d.orig != d.value)" + ).end(fn) + .end(js); + + Mark mark = new Mark(); + hgen.incr(mark,"form","method=post"); + trans.put(sMark, mark); + } } } else { trans.error().printf("Error calling AAF for Roles in GUI, Role Detail %d: %s",fr.code(),fr.body()); diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java index e8468d6a..519721ce 100644 --- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java +++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java @@ -1574,7 +1574,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS } // Look up data - Result<List<RoleDAO.Data>> rlrd = ques.getRolesByName(trans, role); + int query = role.indexOf('?'); + Result<List<RoleDAO.Data>> rlrd = ques.getRolesByName(trans, query<0?role:role.substring(0, query)); if(rlrd.isOK()) { // Note: Mapper will restrict what can be viewed ROLES roles = mapper.newInstance(API.ROLES); |