@SuppressWarnings("serial")
public class LoginServiceImpl extends RemoteServiceServlet implements
LoginService {
@Override
public UserAccountDTO getLoggedInUserDTO(String requestUri) {
UserAccountDTO userDTO = null;
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user != null) {
if (userService.isUserAdmin()) {
userDTO = new UserAccountDTO();
userDTO.setId(new Long(0));
userDTO.setLastname(user.getNickname());
userDTO.setLogin(user.getEmail());
userDTO.setEmail(user.getEmail());
userDTO.setAccessLevel(1);
} else {
userDTO = UserAccount.toDTO(DatastoreProxy.getUserAccountByLogin(user.getEmail()));
if (userDTO == null) {
userDTO = new UserAccountDTO();
userDTO.setLogin(user.getEmail());
}
}
}
userDTO.setLogoutUrl(userService.createLogoutURL(requestUri));
// HttpSession session = super.getThreadLocalRequest().getSession();
return userDTO;
//
// UserAccount u = LoginHelper.getLoggedInUser(session);
// if (u == null)