35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
#ifndef __BLOGSESSION_H__
|
|
#define __BLOGSESSION_H__
|
|
|
|
#include "BlogUserDatabase.h"
|
|
#include <Wt/Auth/Login.h>
|
|
#include <Wt/Auth/OAuthService.h>
|
|
#include <Wt/Dbo/Session.h>
|
|
#include <Wt/Dbo/backend/Sqlite3.h>
|
|
|
|
class Comment;
|
|
|
|
class BlogSession : public Wt::Dbo::Session {
|
|
public:
|
|
BlogSession(Wt::Dbo::SqlConnectionPool &connectionPool);
|
|
static void configureAuth();
|
|
|
|
static std::unique_ptr<Wt::Dbo::SqlConnectionPool> createConnectionPool(const std::string &sqlite3);
|
|
Wt::Auth::Login &login() {
|
|
return m_login;
|
|
}
|
|
Wt::Dbo::ptr<User> user() const;
|
|
Wt::Signal<Wt::Dbo::ptr<Comment>> &commentsChanged();
|
|
BlogUserDatabase &users() {
|
|
return m_users;
|
|
}
|
|
Wt::Auth::PasswordService *passwordAuth() const;
|
|
const std::vector<const Wt::Auth::OAuthService *> &oAuth() const;
|
|
|
|
private:
|
|
Wt::Dbo::SqlConnectionPool &m_connectionPool;
|
|
BlogUserDatabase m_users;
|
|
Wt::Auth::Login m_login;
|
|
Wt::Signal<Wt::Dbo::ptr<Comment>> m_commentsChanged;
|
|
};
|
|
#endif // __BLOGSESSION_H__
|