|
/**************************************************************
|
|
* FPMWebGui Session (Header) (Session.h) *
|
|
* -------------------------- *
|
|
* ??? *
|
|
**************************************************************/
|
|
|
|
|
|
|
|
// Include-Guard: Head
|
|
#ifndef SESSION_H_
|
|
#define SESSION_H_
|
|
|
|
|
|
|
|
// +------------+
|
|
// | Inclusions |
|
|
// +------------+
|
|
|
|
// - Standard
|
|
#include <map>
|
|
#include <vector>
|
|
#include <string>
|
|
// - Wt-Library-Inclusions
|
|
// - - Database
|
|
#include <Wt/Dbo/ptr.h> // https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Dbo_1_1ptr.html
|
|
#include <Wt/Dbo/SqlConnection.h> // https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Dbo_1_1SqlConnection.html
|
|
#include <Wt/Dbo/backend/MySQL.h> // https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Dbo_1_1backend_1_1MySQL.html
|
|
#include <Wt/Dbo/Session.h> // https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Dbo_1_1Session.html
|
|
#include <Wt/Dbo/Exception.h> // https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Dbo_1_1Exception.html
|
|
// - - Authentication
|
|
#include <Wt/Auth/Login.h> // https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Auth_1_1Login.html
|
|
// - Custom Inclusions
|
|
#include "User.h" //
|
|
#include "FillingModel.h" //
|
|
#include "SloshingModel.h" //
|
|
#include "FillingSimulation.h" //
|
|
#include "SloshingSimulation.h" //
|
|
#include "CustomModelTemplate.h" //
|
|
#include "TemplateParameter.h" //
|
|
|
|
|
|
|
|
// Abbreviations
|
|
namespace dbo = Wt::Dbo;
|
|
using UserDatabase = Wt::Auth::Dbo::UserDatabase<AuthInfo>;
|
|
|
|
|
|
// +--------------------------------+
|
|
// | Class- and Function-Prototypes |
|
|
// +--------------------------------+
|
|
|
|
class Session : public dbo::Session {
|
|
|
|
private:
|
|
//dbo::backend::Sqlite3 connection_;
|
|
Wt::Dbo::backend::MySQL *connection_;
|
|
std::unique_ptr<UserDatabase> users_;
|
|
Wt::Auth::Login login_;
|
|
|
|
public:
|
|
static void configureAuth();
|
|
// Session(const std::string& sqliteDb);
|
|
Session();
|
|
//~Session();
|
|
|
|
// dbo::ptr<User> user() const;
|
|
dbo::ptr<User> user();
|
|
dbo::ptr<User> user(const Wt::Auth::User& user);
|
|
|
|
Wt::Auth::AbstractUserDatabase& users();
|
|
Wt::Auth::Login& login() { return login_; }
|
|
|
|
static const Wt::Auth::AuthService& auth();
|
|
static const Wt::Auth::PasswordService& passwordAuth();
|
|
|
|
void addNames();
|
|
//static const std::vector<const Wt::Auth::OAuthService *>& oAuth();
|
|
|
|
void addDataFilling(std::map<std::string,std::string> mySQLTokenMap);
|
|
void addDataSloshing(std::map<std::string,std::string> mySQLTokenMap);
|
|
void updateDataFilling(std::map<std::string,std::string> mySQLTokenMap, const Wt::Dbo::ptr<FillingModel> fm);
|
|
void updateDataSloshing(std::map<std::string,std::string> mySQLTokenMap, const Wt::Dbo::ptr<SloshingModel> sm);
|
|
void startSloshingSimulation(const Wt::Dbo::ptr<SloshingModel> sm, int status, std::string folderName);
|
|
void startFillingSimulation(const Wt::Dbo::ptr<FillingModel> fm,int status, std::string folderName);
|
|
Wt::Dbo::ptr<CustomModelTemplate> createCustomTemplate(std::map<std::string,std::string> mySQLTokenMap);
|
|
void addCustomModelParams(Wt::Dbo::ptr<CustomModelTemplate> id, std::vector<std::string> data);
|
|
void createCustomModel(Wt::Dbo::ptr<CustomModelTemplate> id);
|
|
// const std::vector<const Wt::Auth::OAuthService *>& Session::oAuth();
|
|
|
|
};
|
|
|
|
|
|
|
|
// Include-Guard: Foot
|
|
#endif // SESSION_H_
|