Introducing HandlerConfig class to give handlers config values they need

This commit is contained in:
2019-09-29 20:27:53 +02:00
rodzic 364d82a99f
commit 0ccc20454b
8 zmienionych plików z 36 dodań i 33 usunięć

Wyświetl plik

@@ -1,6 +1,6 @@
#ifndef HANDLER_H
#define HANDLER_H
#include "../config.h"
#include "../response.h"
#include "../request.h"
#include "../template.h"
@@ -17,14 +17,17 @@ class Handler
Database *database;
Session *userSession;
UrlProvider *urlProvider;
HandlerConfig *handlersConfig;
// TODO: may not to find a better place for this method
Permissions effectivePermissions(std::string page);
QueryOption queryOption(const Request &r) const;
public:
Handler(Template &templ, Database &db, Session &userSession, UrlProvider &provider, ICache &cache)
Handler(HandlerConfig &handlersConfig, Template &templ, Database &db, Session &userSession, UrlProvider &provider,
ICache &cache)
{
this->handlersConfig = &handlersConfig;
this->templ = &templ;
this->database = &db;
this->userSession = &userSession;