}
private void setRolesAndAccessLevels(User user) {
// We don't use Seams Role class, wiki currently only uses numeric access levels
Role bestRole = (Role)Component.getInstance("guestRole");
for (Role role : user.getRoles()) {
if (role.getAccessLevel() > bestRole.getAccessLevel()) bestRole = role;
}
if (user.getMemberHome() != null && user.getMemberHome().getName() != null) {
log.debug("initializing users member home instance before detaching currentUser into HTTP session");
}
// Outject current user and access level
Contexts.getSessionContext().set("currentUser", user);
Contexts.getSessionContext().set("currentAccessLevel", bestRole.getAccessLevel());
}