handlers: permisison check for all pages + retrieve user-specific permissions for pages (if any)

This commit is contained in:
2019-05-03 15:59:29 +02:00
부모 e87c3a0f4d
커밋 7630301168
23개의 변경된 파일167개의 추가작업 그리고 34개의 파일을 삭제

파일 보기

@@ -18,6 +18,8 @@ class Handler
Session *userSession;
UrlProvider *urlProvider;
// TODO: may not to find a better place for this method
Permissions effectivePermissions(std::string page);
QueryOption queryOption(const Request &r) const;
public:
@@ -29,7 +31,21 @@ class Handler
this->urlProvider = &provider;
this->cache = &cache;
}
virtual Response handle(const Request &r) = 0;
virtual Response handle(const Request &r);
virtual Response handleRequest(const Request &r)
{
return this->errorResponse("Invalid action", "This action is not implemented yet");
}
virtual bool canAccess(const Permissions &perms)
{
return false;
}
virtual std::string accessErrorMessage()
{
return "No permission for this action";
}
void setGeneralVars(TemplatePage &page);
virtual ~Handler()
{