2021-08-04 19:03:53 +02:00
|
|
|
#ifndef USER_MANAGER_H
|
|
|
|
#define USER_MANAGER_H
|
|
|
|
|
|
|
|
#include "core/object.h"
|
|
|
|
|
|
|
|
#include <map>
|
2021-08-04 21:23:15 +02:00
|
|
|
#include <mutex>
|
2021-08-04 19:03:53 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2021-08-04 19:05:38 +02:00
|
|
|
class User;
|
2021-08-04 19:03:53 +02:00
|
|
|
|
|
|
|
class UserManager : public Object {
|
|
|
|
public:
|
|
|
|
void add_user(User *user);
|
|
|
|
void remove_user(User *user);
|
2021-08-04 21:23:15 +02:00
|
|
|
User *get_user(const std::string &user_name);
|
2021-08-05 19:33:37 +02:00
|
|
|
virtual User *create_user();
|
2021-08-05 19:42:33 +02:00
|
|
|
virtual void load_all();
|
2021-08-04 19:03:53 +02:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
2021-08-04 21:23:15 +02:00
|
|
|
static UserManager *get_singleton();
|
2021-08-04 19:03:53 +02:00
|
|
|
|
|
|
|
UserManager();
|
|
|
|
~UserManager();
|
|
|
|
|
2021-08-04 21:23:15 +02:00
|
|
|
std::map<std::string, User *> _users;
|
|
|
|
std::vector<User *> _users_vec;
|
2021-08-04 19:03:53 +02:00
|
|
|
std::mutex _mutex;
|
|
|
|
|
|
|
|
protected:
|
2021-08-04 21:23:15 +02:00
|
|
|
static UserManager *_self;
|
2021-08-04 19:03:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|