1.出现的问题如下
在输入roles name后,候选项没有更新。在看源码是发现是调用的RoleREST.java接口没有获取传入的name参数
2.解决
org.apache.ranger.rest.RoleREST 类 /roles方法
改为如下:
@GET
@Path("/roles")
public RangerRoleList getAllRoles(@Context HttpServletRequest request, @PathParam("name") String name) {
RangerRoleList ret = new RangerRoleList();
if (LOG.isDebugEnabled()) {
LOG.debug("==> getAllRoles()");
}
String name = request.getParameter("name");
SearchFilter filter = searchUtil.getSearchFilter(request, roleService.sortFields);
List<RangerRole> roles;
try {
ensureAdminAccess(null, null);
roles = roleStore.getRoles(filter);
ret.setRoleList(roles);
List res = new LinkedList<>();
if (name != null) {
name = name.trim();
}
if (name != null && name.length() > 0) {
for (RangerRole rs : roles) {
int index = rs.getName().indexOf(name);
if (index > 0) {
res.add(rs);
}
}
roles = res;
}
ret.setRoleList(roles);
if (roles != null) {
ret.setTotalCount(roles.size());
ret.setSortBy(filter.getSortBy());
ret.setSortType(filter.getSortType());
ret.setResultSize(roles.size());
}
} catch(WebApplicationException excp) {
throw excp;
} catch(Throwable excp) {
LOG.error("getRoles() failed", excp);
throw restErrorUtil.createRESTException(excp.getMessage());
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== getAllRoles():" + ret);
}
return ret;
}
改完后从新编译 成功后 替换 admin包下的RoleREST.class 类 。
替换完后,重启即可解决