2022-07-21 19:33:04 +02:00
|
|
|
#ifndef USER_MANAGER_FILE_H
|
|
|
|
#define USER_MANAGER_FILE_H
|
|
|
|
|
|
|
|
#include "core/os/rw_lock.h"
|
2022-08-17 13:45:14 +02:00
|
|
|
#include "core/object/reference.h"
|
2022-08-17 14:19:55 +02:00
|
|
|
#include "core/string/ustring.h"
|
2022-08-17 12:53:49 +02:00
|
|
|
#include "core/containers/vector.h"
|
2022-07-21 19:33:04 +02:00
|
|
|
|
|
|
|
#include "user_manager.h"
|
|
|
|
|
|
|
|
class User;
|
|
|
|
|
|
|
|
class UserManagerFile : public UserManager {
|
|
|
|
GDCLASS(UserManagerFile, UserManager);
|
|
|
|
|
|
|
|
public:
|
|
|
|
String get_save_folder_path();
|
|
|
|
void set_save_folder_path(const String &val);
|
|
|
|
|
|
|
|
Ref<User> _get_user(const int id);
|
|
|
|
Ref<User> _get_user_name(const String &user);
|
2023-09-22 16:33:21 +02:00
|
|
|
Ref<User> _get_user_email(const String &user_email);
|
|
|
|
|
2022-07-21 19:33:04 +02:00
|
|
|
void _save_user(Ref<User> user);
|
|
|
|
|
|
|
|
Ref<User> _create_user();
|
|
|
|
|
|
|
|
bool _is_username_taken(const String &user_name);
|
|
|
|
bool _is_email_taken(const String &email);
|
|
|
|
|
|
|
|
Vector<Ref<User>> get_all();
|
|
|
|
|
|
|
|
UserManagerFile();
|
|
|
|
~UserManagerFile();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void load();
|
|
|
|
void save();
|
|
|
|
|
|
|
|
void _on_user_changed();
|
|
|
|
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
Vector<Ref<User>> _users;
|
|
|
|
RWLock _rw_lock;
|
|
|
|
bool _save_queued;
|
|
|
|
|
|
|
|
String _save_folder_path;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|