Small fix to user switching, roles should be correctly reset now.

This commit is contained in:
Robin Eklund 2011-08-04 16:27:57 +02:00
parent 2c8df42a18
commit e9273a97eb

@ -157,6 +157,7 @@ public class SciProSession extends WebSession {
user = userDao.save(user); user = userDao.save(user);
} }
//Assign roles //Assign roles
iRoles.clear();
if(roleDao.isStudent(user)){ if(roleDao.isStudent(user)){
iRoles.add(new Student()); iRoles.add(new Student());
} }
@ -208,7 +209,6 @@ public class SciProSession extends WebSession {
return false; return false;
logger.info("Currently logged in user: '"+user.getEmailAddress()+"' attempting switch to '"+suUser+"@"+suRealm+"'"); logger.info("Currently logged in user: '"+user.getEmailAddress()+"' attempting switch to '"+suUser+"@"+suRealm+"'");
if(suUser != null && roleDao.isSysadmin(user)){ if(suUser != null && roleDao.isSysadmin(user)){
iRoles.clear();
return signInAuthenticatedUser(suUser, suRealm); return signInAuthenticatedUser(suUser, suRealm);
}else{ }else{
logger.error("User does not have the privilege to switch user"); logger.error("User does not have the privilege to switch user");