2021-11-10 15:32:44 +01:00
|
|
|
#ifndef RBAC_USER_CONTROLLER_H
|
|
|
|
#define RBAC_USER_CONTROLLER_H
|
|
|
|
|
2022-02-05 15:03:23 +01:00
|
|
|
#include "web_modules/users/user_controller.h"
|
2021-11-10 15:32:44 +01:00
|
|
|
|
2022-02-05 15:30:48 +01:00
|
|
|
#include "web/http/middleware.h"
|
2022-01-08 12:25:52 +01:00
|
|
|
|
2021-11-10 19:35:02 +01:00
|
|
|
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:
|
|
|
|
};
|
|
|
|
|
2022-01-08 12:25:52 +01:00
|
|
|
// 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
|