Nueva propiedad para guardar el displayName del usuario logeado.

This commit is contained in:
Marcos Garcia Nuñez
2019-12-23 16:23:51 +01:00
parent 74ec842f54
commit b0f5c69a47
4 changed files with 39 additions and 26 deletions

View File

@@ -24,7 +24,7 @@ public class SessionUtils {
else
return null;
}
public static HttpSession getSession() {
return getSession(false);
}
@@ -77,6 +77,16 @@ public class SessionUtils {
return "";
}
public static String getUserDisplayName() {
HttpSession session = getSession();
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USER) != null) {
LoggedUserTO usr = LoggedUserTO.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_USER));
return usr.getDisplayName();
} else
return "";
}
public static UserType getUserType() {
return getUserType(getSession());
}

View File

@@ -300,19 +300,19 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
case PATIENT:
PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email);
this.setPatientData(pat);
usr = new LoggedUserTO(pat.getId().toString(), pat.getName(), pat.getPassword(), this.userType);
usr = new LoggedUserTO(pat.getId().toString(), pat.getName(), pat.getPassword(), this.userType, pat.getDisplayName());
break;
case FAMILY_DOCTOR:
FamilyDoctorTO fd = this.getRemoteManagerProfile().updateFamilyDoctorData(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
this.setFamilyDoctorData(fd);
usr = new LoggedUserTO(fd.getId().toString(), fd.getName(), fd.getPassword(), this.userType);
usr = new LoggedUserTO(fd.getId().toString(), fd.getName(), fd.getPassword(), this.userType, fd.getDisplayName());
break;
case SPECIALIST_DOCTOR:
SpecialistDoctorTO sd = this.getRemoteManagerProfile().updateSpecialistDoctorData(id, nif, name, surname, password, email, this.medicalSpecialty);
this.setSpecialistDoctorData(sd);
usr = new LoggedUserTO(sd.getId().toString(), sd.getName(), sd.getPassword(), this.userType);
usr = new LoggedUserTO(sd.getId().toString(), sd.getName(), sd.getPassword(), this.userType, sd.getDisplayName());
break;
case ADMINISTRATOR: