rcpp_framework/web_modules/rbac_users/rbac_user_controller.h

54 lines
1.2 KiB
C
Raw Permalink Normal View History

2021-11-10 15:32:44 +01:00
#ifndef RBAC_USER_CONTROLLER_H
#define RBAC_USER_CONTROLLER_H
#include "web_modules/users/user_controller.h"
2021-11-10 15:32:44 +01:00
#include "web/http/middleware.h"
class Request;
2021-11-10 15:32:44 +01:00
class RBACUserController : public UserController {
RCPP_OBJECT(RBACUserController, UserController);
2022-01-07 17:50:39 +01:00
2021-11-10 15:32:44 +01:00
public:
2022-01-07 17:50:39 +01:00
// db
Ref<User> db_get_user(const int id);
Ref<User> db_get_user(const String &user_name_input);
Vector<Ref<User> > db_get_all();
Ref<User> create_user();
2021-11-10 15:32:44 +01:00
RBACUserController();
~RBACUserController();
protected:
};
// just session setup
class RBACUserSessionSetupMiddleware : public Middleware {
RCPP_OBJECT(RBACUserSessionSetupMiddleware, Middleware);
public:
//returnring true means handled, false means continue
bool on_before_handle_request_main(Request *request);
RBACUserSessionSetupMiddleware();
~RBACUserSessionSetupMiddleware();
};
// this one also handles missing read permission / redirect
class RBACDefaultUserSessionSetupMiddleware : public Middleware {
RCPP_OBJECT(RBACDefaultUserSessionSetupMiddleware, Middleware);
public:
//returnring true means handled, false means continue
bool on_before_handle_request_main(Request *request);
RBACDefaultUserSessionSetupMiddleware();
~RBACDefaultUserSessionSetupMiddleware();
};
2021-11-10 15:32:44 +01:00
#endif