#include "Session.h" #include Session::Session(Wt::Dbo::SqlConnectionPool &connectionPool) { setConnectionPool(connectionPool); mapClass("task"); mapClass("homebox_item"); mapClass("user"); mapClass("auth_info"); mapClass("auth_identity"); mapClass("auth_token"); m_users = std::make_unique(*this); } Session::~Session() { } Wt::Dbo::ptr Session::user() const { if (m_login.loggedIn()) { Wt::Dbo::ptr authInfo = m_users->find(m_login.user()); return authInfo->user(); } else return Wt::Dbo::ptr(); } Wt::Auth::AbstractUserDatabase &Session::users() { return *m_users; } Wt::Auth::Login &Session::login() { return m_login; } DBO_INSTANTIATE_TEMPLATES(User) DBO_INSTANTIATE_TEMPLATES(Task) DBO_INSTANTIATE_TEMPLATES(HomeBox::Item)