mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-05-10 07:32:08 +02:00
Now get_all_as_vector() in UserManager is not virtual anymore. Also removed other implementations.
- This had to be done as get_all_as_vector() cannot be customized by scripts, and if an inherited UserManager needs to set up UserModules this will cause issues later down the line. - Other solutions like a user_setup() method could also work, but then that would cause more individual (non-optimizable) lookups to db-based backends (and likely others too), so this solution seems to be the best currently.
This commit is contained in:
parent
8a1981d1b8
commit
fd13bb3c51
@ -66,7 +66,7 @@ public:
|
||||
virtual bool _is_username_taken(const String &user_name);
|
||||
virtual bool _is_email_taken(const String &email);
|
||||
|
||||
virtual Vector<Ref<User>> get_all_as_vector();
|
||||
Vector<Ref<User>> get_all_as_vector();
|
||||
|
||||
Array get_all_users();
|
||||
virtual Array _get_all_users();
|
||||
|
@ -274,38 +274,6 @@ bool UserManagerDB::_is_email_taken(const String &email) {
|
||||
return r->next_row();
|
||||
}
|
||||
|
||||
Vector<Ref<User>> UserManagerDB::get_all_as_vector() {
|
||||
Ref<QueryBuilder> b = get_query_builder();
|
||||
|
||||
b->select("id, username, email, rank, pre_salt, post_salt, password_hash, banned, password_reset_token, locked");
|
||||
b->from(_database_table_name);
|
||||
b->end_command();
|
||||
// b->print();
|
||||
|
||||
Vector<Ref<User>> users;
|
||||
|
||||
Ref<QueryResult> r = b->run();
|
||||
|
||||
while (r->next_row()) {
|
||||
Ref<User> user = create_user();
|
||||
|
||||
user->set_user_id(r->get_cell_int(0));
|
||||
user->set_user_name(r->get_cell(1));
|
||||
user->set_email(r->get_cell(2));
|
||||
user->set_rank(r->get_cell_int(3));
|
||||
user->set_pre_salt(r->get_cell(4));
|
||||
user->set_post_salt(r->get_cell(5));
|
||||
user->set_password_hash(r->get_cell(6));
|
||||
user->set_banned(r->get_cell_bool(7));
|
||||
user->set_password_reset_token(r->get_cell(8));
|
||||
user->set_locked(r->get_cell_bool(9));
|
||||
|
||||
users.push_back(user);
|
||||
}
|
||||
|
||||
return users;
|
||||
}
|
||||
|
||||
Array UserManagerDB::_get_all_users() {
|
||||
Ref<QueryBuilder> b = get_query_builder();
|
||||
|
||||
|
@ -70,7 +70,6 @@ public:
|
||||
bool _is_username_taken(const String &user_name);
|
||||
bool _is_email_taken(const String &email);
|
||||
|
||||
Vector<Ref<User>> get_all_as_vector();
|
||||
Array _get_all_users();
|
||||
|
||||
void create_table();
|
||||
|
@ -152,10 +152,6 @@ bool UserManagerFile::_is_email_taken(const String &email) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector<Ref<User>> UserManagerFile::get_all_as_vector() {
|
||||
return _users;
|
||||
}
|
||||
|
||||
Array UserManagerFile::_get_all_users() {
|
||||
Array ret;
|
||||
|
||||
|
@ -59,7 +59,6 @@ public:
|
||||
bool _is_username_taken(const String &user_name);
|
||||
bool _is_email_taken(const String &email);
|
||||
|
||||
Vector<Ref<User>> get_all_as_vector();
|
||||
Array _get_all_users();
|
||||
|
||||
UserManagerFile();
|
||||
|
@ -105,10 +105,6 @@ bool UserManagerStatic::_is_email_taken(const String &email) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector<Ref<User>> UserManagerStatic::get_all_as_vector() {
|
||||
return _users;
|
||||
}
|
||||
|
||||
Array UserManagerStatic::_get_all_users() {
|
||||
Array ret;
|
||||
|
||||
|
@ -56,7 +56,6 @@ public:
|
||||
bool _is_username_taken(const String &user_name);
|
||||
bool _is_email_taken(const String &email);
|
||||
|
||||
Vector<Ref<User>> get_all_as_vector();
|
||||
Array _get_all_users();
|
||||
|
||||
Vector<Variant> get_users();
|
||||
|
Loading…
Reference in New Issue
Block a user