Added a new rbac_user module.

This commit is contained in:
Relintai 2021-11-10 15:32:44 +01:00
parent 60e22942e4
commit 93e95a865f
10 changed files with 181 additions and 0 deletions

12
modules/rbac_users/SCsub Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env python
Import("env_mod")
Import("env")
env_mod.core_sources = []
env_mod.add_source_files(env_mod.core_sources, "*.cpp")
# Build it all as a library
lib = env_mod.add_library("users", env_mod.core_sources)
env.Prepend(LIBS=[lib])

View File

@ -0,0 +1,33 @@
import os
import platform
import sys
def is_active():
return True
def get_name():
return "users"
def can_build():
return True
def get_opts():
return []
def get_flags():
return []
def configure(env):
pass
def get_module_dependencies():
return [
"users",
"rbac"
]

View File

@ -0,0 +1,8 @@
#include "rbac_user.h"
RBACUser::RBACUser() :
User() {
}
RBACUser::~RBACUser() {
}

View File

@ -0,0 +1,19 @@
#ifndef RBAC_USER_H
#define RBAC_USER_H
#include "core/string.h"
#include "modules/users/user.h"
class Request;
class FormValidator;
class RBACUser : public User {
RCPP_OBJECT(RBACUser, User);
public:
RBACUser();
~RBACUser();
};
#endif

View File

@ -0,0 +1,8 @@
#include "rbac_user_controller.h"
RBACUserController::RBACUserController() :
UserController() {
}
RBACUserController::~RBACUserController() {
}

View File

@ -0,0 +1,16 @@
#ifndef RBAC_USER_CONTROLLER_H
#define RBAC_USER_CONTROLLER_H
#include "modules/users/user_controller.h"
class RBACUserController : public UserController {
RCPP_OBJECT(RBACUserController, UserController);
public:
RBACUserController();
~RBACUserController();
protected:
};
#endif

View File

@ -0,0 +1,37 @@
#include "rbac_user_initializer.h"
void UserInitializer::allocate_controller() {
ERR_FAIL_COND(_controller);
_controller = new RBACUserController();
}
void UserInitializer::free_controller() {
if (_controller) {
delete _controller;
_controller = nullptr;
}
}
void UserInitializer::allocate_model() {
ERR_FAIL_COND(_model);
_model = new RBACUserModel();
}
void UserInitializer::free_model() {
if (_model) {
delete _model;
_model = nullptr;
}
}
void UserInitializer::allocate_all() {
allocate_model();
allocate_controller();
}
void UserInitializer::free_all() {
free_controller();
free_model();
}
RBACUserController *UserInitializer::_controller = nullptr;
RBACUserModel *UserInitializer::_model = nullptr;

View File

@ -0,0 +1,23 @@
#ifndef USER_INITIALIZER_H
#define USER_INITIALIZER_H
#include "rbac_user_model.h"
#include "rbac_user_controller.h"
class UserInitializer {
public:
static void allocate_controller();
static void free_controller();
static void allocate_model();
static void free_model();
static void allocate_all();
static void free_all();
protected:
static RBACUserController *_controller;
static RBACUserModel *_model;
};
#endif

View File

@ -0,0 +1,9 @@
#include "rbac_user_model.h"
RBACUserModel::RBACUserModel() :
UserModel() {
}
RBACUserModel::~RBACUserModel() {
}

View File

@ -0,0 +1,16 @@
#ifndef RBAC_USER_MODEL_H
#define RBAC_USER_MODEL_H
#include "modules/users/user_model.h"
class RBACUserModel : public UserModel {
RCPP_OBJECT(RBACUserModel, UserModel);
public:
RBACUserModel();
~RBACUserModel();
protected:
};
#endif