Add Visione backend foundation
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <drogon/HttpRequest.h>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace visione::auth
|
||||
{
|
||||
struct UserContext
|
||||
{
|
||||
long long id{0};
|
||||
std::string email;
|
||||
std::string role;
|
||||
};
|
||||
|
||||
std::optional<std::string> bearerToken(const drogon::HttpRequestPtr &request);
|
||||
std::optional<UserContext> authenticate(const drogon::HttpRequestPtr &request);
|
||||
bool hasRole(const UserContext &user, const std::string &role);
|
||||
bool canManageReports(const UserContext &user);
|
||||
bool isAdmin(const UserContext &user);
|
||||
} // namespace visione::auth
|
||||
|
||||
Reference in New Issue
Block a user