X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8ecd9d2cf879cfa584c387fc74343e9ea03f9c1d..04c52c861598a001bfe217ef6ebe5c4c0d4c6354:/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp?ds=sidebyside diff --git a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp index 72fb399e..0c28c60b 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp @@ -1,14 +1,17 @@ +#include + #include "users_methods.h" -#include "../../../users.h" -#include "../../../admins.h" -#include "../../../tariffs.h" +#include "users.h" +#include "admins.h" +#include "tariffs.h" #include "rpcconfig.h" #include "user_helper.h" #include "user_ips.h" #include "utils.h" #include "common.h" +#include "user_property.h" //------------------------------------------------------------------------------ @@ -30,7 +33,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -68,7 +71,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin = NULL; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -76,7 +79,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -112,7 +115,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -120,9 +123,9 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; -if (users->FindByName(login, &u)) +if (!users->FindByName(login, &u)) { users->Del(login, admin); *retvalPtr = xmlrpc_c::value_boolean(true); @@ -156,7 +159,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) bool hidePassword = !adminInfo.priviledges.userConf || !adminInfo.priviledges.userPasswd; -user_iter u; +USER_PTR u; int h = users->OpenSearch(); if (!h) @@ -204,7 +207,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -212,7 +215,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -257,7 +260,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -265,7 +268,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -273,10 +276,10 @@ if (users->FindByName(login, &u)) return; } -double cash = u->property.cash.Get(); +double cash = u->GetProperty().cash.Get(); cash += amount; -if (!u->property.cash.Set(cash, admin, login, store, comment)) +if (!u->GetProperty().cash.Set(cash, admin, login, store, comment)) { *retvalPtr = xmlrpc_c::value_boolean(false); return; @@ -307,7 +310,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -315,7 +318,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -323,7 +326,7 @@ if (users->FindByName(login, &u)) return; } -if (!u->property.cash.Set(cash, admin, login, store, comment)) +if (!u->GetProperty().cash.Set(cash, admin, login, store, comment)) { *retvalPtr = xmlrpc_c::value_boolean(false); return; @@ -355,7 +358,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -363,7 +366,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -375,10 +378,10 @@ if (tariffs->FindByName(tariff)) { if (delayed) { - if (u->property.nextTariff.Set(tariff, - admin, - login, - store)) + if (u->GetProperty().nextTariff.Set(tariff, + admin, + login, + store)) { u->WriteConf(); *retvalPtr = xmlrpc_c::value_boolean(true); @@ -387,10 +390,10 @@ if (tariffs->FindByName(tariff)) } else { - if (u->property.tariffName.Set(tariff, - admin, - login, - store)) + if (u->GetProperty().tariffName.Set(tariff, + admin, + login, + store)) { u->WriteConf(); *retvalPtr = xmlrpc_c::value_boolean(true); @@ -440,7 +443,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) std::vector ips; -user_iter u; +USER_PTR u; int handle = users->OpenSearch(); if (!handle)