mirror of
https://github.com/Relintai/mourne_rcpp_fw.git
synced 2024-12-27 23:17:11 +01:00
Created a new UserModel, that creates the test admin account with the proper userlevel.
This commit is contained in:
parent
c65bc0d6b7
commit
ec4ac1b3bc
30
app/mourne_user_model.cpp
Normal file
30
app/mourne_user_model.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "mourne_user_model.h"
|
||||||
|
|
||||||
|
void MourneUserModel::create_test_users() {
|
||||||
|
Ref<User> user;
|
||||||
|
user = UserModel::get_singleton()->create_user();
|
||||||
|
|
||||||
|
user->rank = 6;
|
||||||
|
user->name_user_input = "admin";
|
||||||
|
user->email_user_input = "admin@admin.com";
|
||||||
|
|
||||||
|
create_password(user, "Password");
|
||||||
|
save_user(user);
|
||||||
|
|
||||||
|
|
||||||
|
user = UserModel::get_singleton()->create_user();
|
||||||
|
|
||||||
|
user->rank = 1;
|
||||||
|
user->name_user_input = "user";
|
||||||
|
user->email_user_input = "user@user.com";
|
||||||
|
|
||||||
|
create_password(user, "Password");
|
||||||
|
save_user(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
MourneUserModel::MourneUserModel() :
|
||||||
|
UserModel() {
|
||||||
|
}
|
||||||
|
|
||||||
|
MourneUserModel::~MourneUserModel() {
|
||||||
|
}
|
23
app/mourne_user_model.h
Normal file
23
app/mourne_user_model.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef MOURNE_USER_MODEL_H
|
||||||
|
#define MOURNE_USER_MODEL_H
|
||||||
|
|
||||||
|
#include "core/string.h"
|
||||||
|
#include "core/containers/vector.h"
|
||||||
|
|
||||||
|
#include "modules/users/user_model.h"
|
||||||
|
|
||||||
|
#include "modules/users/user.h"
|
||||||
|
|
||||||
|
class MourneUserModel : public UserModel {
|
||||||
|
RCPP_OBJECT(MourneUserModel, UserModel);
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void create_test_users();
|
||||||
|
|
||||||
|
MourneUserModel();
|
||||||
|
~MourneUserModel();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
6
main.cpp
6
main.cpp
@ -20,8 +20,8 @@
|
|||||||
#include "backends/hash_hashlib/setup.h"
|
#include "backends/hash_hashlib/setup.h"
|
||||||
|
|
||||||
#include "app/mourne_user_controller.h"
|
#include "app/mourne_user_controller.h"
|
||||||
|
#include "app/mourne_user_model.h"
|
||||||
#include "modules/users/user.h"
|
#include "modules/users/user.h"
|
||||||
#include "modules/users/user_model.h"
|
|
||||||
|
|
||||||
#include "core/os/platform.h"
|
#include "core/os/platform.h"
|
||||||
#include "platform/platform_initializer.h"
|
#include "platform/platform_initializer.h"
|
||||||
@ -50,8 +50,8 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
::SessionManager *session_manager = new ::SessionManager();
|
::SessionManager *session_manager = new ::SessionManager();
|
||||||
|
|
||||||
//todo init these in the module automatically
|
//todo init these in the module automatically
|
||||||
UserController *user_controller = new MourneUserController();
|
MourneUserController *user_controller = new MourneUserController();
|
||||||
UserModel *user_model = new UserModel();
|
MourneUserModel *user_model = new MourneUserModel();
|
||||||
//user_manager->set_path("./users/");
|
//user_manager->set_path("./users/");
|
||||||
|
|
||||||
Settings *settings = new Settings(true);
|
Settings *settings = new Settings(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user