Hi all,
If a menu doesn't define any roles, isUserInRoles will return false. I wonder if this is the correct
default. Wouldn't it be better to return true if no roles are defined? Otherwise one will have to
define an anonymous role and set it on these menus.
regards
bob
Proposed change:
public boolean isUserInRoles() {
// PROPOSED CHANGE START
List roles = getRoles();
if (roles == null || roles.isEmpty()) {
return true;
}
// END
if (getAccessController() == null) {
String msg = "Menu accessController has not been defined";
throw new IllegalStateException(msg);
}
HttpServletRequest request = getContext().getRequest();
for (int i = 0, size = roles.size(); i < size; i++) {
String rolename = (String) roles.get(i);
if (getAccessController().hasAccess(request, rolename)) {
return true;
}
}
return false;
}