Added helpers to simplify session data accesses. Made the CoverResource global to the session

This commit is contained in:
emeric
2015-06-07 21:00:37 +02:00
parent 43211d8aee
commit 530c8dc44d
49 changed files with 407 additions and 518 deletions
+16 -5
View File
@@ -20,31 +20,42 @@
#ifndef LMS_APPLICATION_HPP
#define LMS_APPLICATION_HPP
#include <boost/filesystem.hpp>
#include <Wt/WApplication>
#include "common/SessionData.hpp"
#include "database/DatabaseHandler.hpp"
#include "resource/CoverResource.hpp"
namespace UserInterface {
class LmsApplication : public Wt::WApplication
{
public:
static Wt::WApplication *create(const Wt::WEnvironment& env, boost::filesystem::path dbPath);
static LmsApplication* instance();
LmsApplication(const Wt::WEnvironment& env, boost::filesystem::path dbPath);
// Session application data
CoverResource* getCoverResource() { return _coverResource; }
Database::Handler& getDbHandler() { return _db;}
private:
void handleAuthEvent(void);
void createFirstConnectionUI();
void createLmsUI();
SessionData _sessionData;
Database::Handler _db;
CoverResource* _coverResource;
};
// Helpers to get session data
Database::Handler& DbHandler();
Wt::Dbo::Session& DboSession();
const Wt::Auth::User& CurrentAuthUser();
Database::User::pointer CurrentUser();
} // namespace UserInterface