TrinityCore
Loading...
Searching...
No Matches
AccountMgr.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "AccountMgr.h"
19#include "Config.h"
20#include "DatabaseEnv.h"
21#include "CryptoHash.h"
22#include "Log.h"
23#include "ObjectAccessor.h"
24#include "Player.h"
25#include "RealmList.h"
26#include "ScriptMgr.h"
27#include "SRP6.h"
28#include "Util.h"
29#include "WorldSession.h"
30
32
34
39
45
46AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password, std::string email /*= ""*/, uint32 bnetAccountId /*= 0*/, uint8 bnetIndex /*= 0*/)
47{
48 if (utf8length(username) > MAX_ACCOUNT_STR)
49 return AccountOpResult::AOR_NAME_TOO_LONG; // username's too long
50
51 if (utf8length(password) > MAX_PASS_STR)
52 return AccountOpResult::AOR_PASS_TOO_LONG; // password's too long
53
54 Utf8ToUpperOnlyLatin(username);
55 Utf8ToUpperOnlyLatin(password);
57
58 if (GetId(username))
59 return AccountOpResult::AOR_NAME_ALREADY_EXIST; // username does already exist
60
62
63 stmt->setString(0, username);
64 auto [salt, verifier] = Trinity::Crypto::SRP6::MakeRegistrationData<AccountSRP6>(username, password);
65 stmt->setBinary(1, salt);
66 stmt->setBinary(2, std::move(verifier));
67 stmt->setString(3, email);
68 stmt->setString(4, email);
69
70 if (bnetAccountId && bnetIndex)
71 {
72 stmt->setUInt32(5, bnetAccountId);
73 stmt->setUInt8(6, bnetIndex);
74 }
75 else
76 {
77 stmt->setNull(5);
78 stmt->setNull(6);
79 }
80
81 LoginDatabase.DirectExecute(stmt); // Enforce saving, otherwise AddGroup can fail
82
83 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS_INIT);
84 LoginDatabase.Execute(stmt);
85
86 return AccountOpResult::AOR_OK; // everything's fine
87}
88
90{
91 // Check if accounts exists
93 loginStmt->setUInt32(0, accountId);
94 PreparedQueryResult result = LoginDatabase.Query(loginStmt);
95
96 if (!result)
98
99 // Obtain accounts characters
101
102 stmt->setUInt32(0, accountId);
103
104 result = CharacterDatabase.Query(stmt);
105
106 if (result)
107 {
108 do
109 {
110 ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt64());
111
112 // Kick if player is online
114 {
115 WorldSession* s = p->GetSession();
116 s->KickPlayer("AccountMgr::DeleteAccount Deleting the account"); // mark session to remove at next session list update
117 s->LogoutPlayer(false); // logout player without waiting next session list update
118 }
119
120 Player::DeleteFromDB(guid, accountId, false); // no need to update realm characters
121 } while (result->NextRow());
122 }
123
124 // table realm specific but common for all characters of account for realm
125 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS);
126 stmt->setUInt32(0, accountId);
127 CharacterDatabase.Execute(stmt);
128
129 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ACCOUNT_DATA);
130 stmt->setUInt32(0, accountId);
131 CharacterDatabase.Execute(stmt);
132
133 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_BAN);
134 stmt->setUInt32(0, accountId);
135 CharacterDatabase.Execute(stmt);
136
137 LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
138
139 loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT);
140 loginStmt->setUInt32(0, accountId);
141 trans->Append(loginStmt);
142
143 loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS);
144 loginStmt->setUInt32(0, accountId);
145 trans->Append(loginStmt);
146
147 loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS);
148 loginStmt->setUInt32(0, accountId);
149 trans->Append(loginStmt);
150
151 loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_BANNED);
152 loginStmt->setUInt32(0, accountId);
153 trans->Append(loginStmt);
154
155 loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_MUTED);
156 loginStmt->setUInt32(0, accountId);
157 trans->Append(loginStmt);
158
159 LoginDatabase.CommitTransaction(trans);
160
162}
163
164AccountOpResult AccountMgr::ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword)
165{
166 // Check if accounts exists
168 stmt->setUInt32(0, accountId);
169 PreparedQueryResult result = LoginDatabase.Query(stmt);
170
171 if (!result)
173
174 if (utf8length(newUsername) > MAX_ACCOUNT_STR)
176
177 if (utf8length(newPassword) > MAX_PASS_STR)
179
180 Utf8ToUpperOnlyLatin(newUsername);
181 Utf8ToUpperOnlyLatin(newPassword);
182
183 stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_USERNAME);
184 stmt->setString(0, newUsername);
185 stmt->setUInt32(1, accountId);
186 LoginDatabase.Execute(stmt);
187
188 auto [salt, verifier] = Trinity::Crypto::SRP6::MakeRegistrationData<AccountSRP6>(newUsername, newPassword);
189 stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGON);
190 stmt->setBinary(0, salt);
191 stmt->setBinary(1, std::move(verifier));
192 stmt->setUInt32(2, accountId);
193 LoginDatabase.Execute(stmt);
194
196}
197
198AccountOpResult AccountMgr::ChangePassword(uint32 accountId, std::string newPassword)
199{
200 std::string username;
201
202 if (!GetName(accountId, username))
203 {
204 sScriptMgr->OnFailedPasswordChange(accountId);
205 return AccountOpResult::AOR_NAME_NOT_EXIST; // account doesn't exist
206 }
207
208 if (utf8length(newPassword) > MAX_PASS_STR)
209 {
210 sScriptMgr->OnFailedPasswordChange(accountId);
212 }
213
214 Utf8ToUpperOnlyLatin(username);
215 Utf8ToUpperOnlyLatin(newPassword);
216 auto [salt, verifier] = Trinity::Crypto::SRP6::MakeRegistrationData<AccountSRP6>(username, newPassword);
217
219 stmt->setBinary(0, salt);
220 stmt->setBinary(1, std::move(verifier));
221 stmt->setUInt32(2, accountId);
222 LoginDatabase.Execute(stmt);
223
224 sScriptMgr->OnPasswordChange(accountId);
226}
227
228AccountOpResult AccountMgr::ChangeEmail(uint32 accountId, std::string newEmail)
229{
230 std::string username;
231
232 if (!GetName(accountId, username))
233 {
234 sScriptMgr->OnFailedEmailChange(accountId);
235 return AccountOpResult::AOR_NAME_NOT_EXIST; // account doesn't exist
236 }
237
238 if (utf8length(newEmail) > MAX_EMAIL_STR)
239 {
240 sScriptMgr->OnFailedEmailChange(accountId);
242 }
243
244 Utf8ToUpperOnlyLatin(username);
245 Utf8ToUpperOnlyLatin(newEmail);
246
248
249 stmt->setString(0, newEmail);
250 stmt->setUInt32(1, accountId);
251
252 LoginDatabase.Execute(stmt);
253
254 sScriptMgr->OnEmailChange(accountId);
256}
257
258AccountOpResult AccountMgr::ChangeRegEmail(uint32 accountId, std::string newEmail)
259{
260 std::string username;
261
262 if (!GetName(accountId, username))
263 {
264 sScriptMgr->OnFailedEmailChange(accountId);
265 return AccountOpResult::AOR_NAME_NOT_EXIST; // account doesn't exist
266 }
267
268 if (utf8length(newEmail) > MAX_EMAIL_STR)
269 {
270 sScriptMgr->OnFailedEmailChange(accountId);
272 }
273
274 Utf8ToUpperOnlyLatin(username);
275 Utf8ToUpperOnlyLatin(newEmail);
276
278
279 stmt->setString(0, newEmail);
280 stmt->setUInt32(1, accountId);
281
282 LoginDatabase.Execute(stmt);
283
284 sScriptMgr->OnEmailChange(accountId);
286}
287
288uint32 AccountMgr::GetId(std::string_view username)
289{
291 stmt->setString(0, username);
292 PreparedQueryResult result = LoginDatabase.Query(stmt);
293
294 return (result) ? (*result)[0].GetUInt32() : 0;
295}
296
298{
300 stmt->setUInt32(0, accountId);
301 stmt->setInt32(1, realmId);
302 PreparedQueryResult result = LoginDatabase.Query(stmt);
303
304 return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER);
305}
306
307QueryCallback AccountMgr::GetSecurityAsync(uint32 accountId, int32 realmId, std::function<void(uint32)> callback)
308{
310 stmt->setUInt32(0, accountId);
311 stmt->setInt32(1, realmId);
312 return LoginDatabase.AsyncQuery(stmt).WithPreparedCallback([callback = std::move(callback)](PreparedQueryResult result)
313 {
314 callback(result ? uint32((*result)[0].GetUInt8()) : uint32(SEC_PLAYER));
315 });
316}
317
318bool AccountMgr::GetName(uint32 accountId, std::string& name)
319{
321 stmt->setUInt32(0, accountId);
322 PreparedQueryResult result = LoginDatabase.Query(stmt);
323
324 if (result)
325 {
326 name = (*result)[0].GetString();
327 return true;
328 }
329
330 return false;
331}
332
333bool AccountMgr::GetEmail(uint32 accountId, std::string& email)
334{
336 stmt->setUInt32(0, accountId);
337 PreparedQueryResult result = LoginDatabase.Query(stmt);
338
339 if (result)
340 {
341 email = (*result)[0].GetString();
342 return true;
343 }
344
345 return false;
346}
347
348bool AccountMgr::CheckPassword(std::string username, std::string password)
349{
350 Utf8ToUpperOnlyLatin(username);
351 Utf8ToUpperOnlyLatin(password);
352
354 stmt->setString(0, username);
355
356 if (PreparedQueryResult result = LoginDatabase.Query(stmt))
357 {
358 Trinity::Crypto::SRP::Salt salt = (*result)[0].GetBinary<Trinity::Crypto::SRP::SALT_LENGTH>();
359 Trinity::Crypto::SRP::Verifier verifier = (*result)[1].GetBinary();
360 if (AccountSRP6(username, salt, verifier).CheckCredentials(username, password))
361 return true;
362 }
363
364 return false;
365}
366
367bool AccountMgr::CheckPassword(uint32 accountId, std::string password)
368{
369 std::string username;
370
371 if (!GetName(accountId, username))
372 return false;
373
374 Utf8ToUpperOnlyLatin(username);
375 Utf8ToUpperOnlyLatin(password);
376
378 stmt->setUInt32(0, accountId);
379
380 if (PreparedQueryResult result = LoginDatabase.Query(stmt))
381 {
382 Trinity::Crypto::SRP::Salt salt = (*result)[0].GetBinary<Trinity::Crypto::SRP::SALT_LENGTH>();
383 Trinity::Crypto::SRP::Verifier verifier = (*result)[1].GetBinary();
384 if (AccountSRP6(username, salt, verifier).CheckCredentials(username, password))
385 return true;
386 }
387
388 return false;
389}
390
391bool AccountMgr::CheckEmail(uint32 accountId, std::string newEmail)
392{
393 std::string oldEmail;
394
395 // We simply return false for a non-existing email
396 if (!GetEmail(accountId, oldEmail))
397 return false;
398
399 Utf8ToUpperOnlyLatin(oldEmail);
400 Utf8ToUpperOnlyLatin(newEmail);
401
402 if (strcmp(oldEmail.c_str(), newEmail.c_str()) == 0)
403 return true;
404
405 return false;
406}
407
409{
410 // check character count
412 stmt->setUInt32(0, accountId);
413 PreparedQueryResult result = CharacterDatabase.Query(stmt);
414
415 return (result) ? (*result)[0].GetUInt64() : 0;
416}
417
418bool AccountMgr::IsBannedAccount(std::string const& name)
419{
421 stmt->setString(0, name);
422 PreparedQueryResult result = LoginDatabase.Query(stmt);
423
424 if (!result)
425 return false;
426
427 return true;
428}
429
431{
432 return gmlevel == SEC_PLAYER;
433}
434
436{
437 return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE;
438}
439
441{
442 return gmlevel == SEC_CONSOLE;
443}
444
446{
447 ClearRBAC();
448
449 TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC");
450 uint32 oldMSTime = getMSTime();
451 uint32 count1 = 0;
452 uint32 count2 = 0;
453 uint32 count3 = 0;
454
455 TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading permissions");
456 QueryResult result = LoginDatabase.Query("SELECT id, name FROM rbac_permissions");
457 if (!result)
458 {
459 TC_LOG_INFO("server.loading", ">> Loaded 0 account permission definitions. DB table `rbac_permissions` is empty.");
460 return;
461 }
462
463 do
464 {
465 Field* field = result->Fetch();
466 uint32 id = field[0].GetUInt32();
467 _permissions[id] = new rbac::RBACPermission(id, field[1].GetString());
468 ++count1;
469 }
470 while (result->NextRow());
471
472 TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading linked permissions");
473 result = LoginDatabase.Query("SELECT id, linkedId FROM rbac_linked_permissions ORDER BY id ASC");
474 if (!result)
475 {
476 TC_LOG_INFO("server.loading", ">> Loaded 0 linked permissions. DB table `rbac_linked_permissions` is empty.");
477 return;
478 }
479
480 uint32 permissionId = 0;
481 rbac::RBACPermission* permission = nullptr;
482
483 do
484 {
485 Field* field = result->Fetch();
486 uint32 newId = field[0].GetUInt32();
487 if (permissionId != newId)
488 {
489 permissionId = newId;
490 permission = _permissions[newId];
491 }
492
493 uint32 linkedPermissionId = field[1].GetUInt32();
494 if (linkedPermissionId == permissionId)
495 {
496 TC_LOG_ERROR("sql.sql", "RBAC Permission {} has itself as linked permission. Ignored", permissionId);
497 continue;
498 }
499 permission->AddLinkedPermission(linkedPermissionId);
500 ++count2;
501 }
502 while (result->NextRow());
503
504 TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading default permissions");
505 result = LoginDatabase.PQuery("SELECT secId, permissionId FROM rbac_default_permissions WHERE (realmId = {} OR realmId = -1) ORDER BY secId ASC", sRealmList->GetCurrentRealmId().Realm);
506 if (!result)
507 {
508 TC_LOG_INFO("server.loading", ">> Loaded 0 default permission definitions. DB table `rbac_default_permissions` is empty.");
509 return;
510 }
511
512 uint8 secId = 255;
513 rbac::RBACPermissionContainer* permissions = nullptr;
514 do
515 {
516 Field* field = result->Fetch();
517 uint32 newId = field[0].GetUInt32();
518 if (secId != newId || permissions == nullptr)
519 {
520 secId = newId;
521 permissions = &_defaultPermissions[secId];
522 }
523
524 permissions->insert(field[1].GetUInt32());
525 ++count3;
526 }
527 while (result->NextRow());
528
529 TC_LOG_INFO("server.loading", ">> Loaded {} permission definitions, {} linked permissions and {} default permissions in {} ms", count1, count2, count3, GetMSTimeDiffToNow(oldMSTime));
530}
531
532void AccountMgr::UpdateAccountAccess(rbac::RBACData* rbac, uint32 accountId, uint8 securityLevel, int32 realmId)
533{
534 if (rbac && securityLevel != rbac->GetSecurityLevel())
535 rbac->SetSecurityLevel(securityLevel);
536
537 LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
538 // Delete old security level from DB
539 if (realmId == -1)
540 {
542 stmt->setUInt32(0, accountId);
543 trans->Append(stmt);
544 }
545 else
546 {
548 stmt->setUInt32(0, accountId);
549 stmt->setUInt32(1, realmId);
550 trans->Append(stmt);
551 }
552
553 // Add new security level
554 if (securityLevel)
555 {
557 stmt->setUInt32(0, accountId);
558 stmt->setUInt8(1, securityLevel);
559 stmt->setInt32(2, realmId);
560 trans->Append(stmt);
561 }
562
563 LoginDatabase.CommitTransaction(trans);
564}
565
567{
568 TC_LOG_TRACE("rbac", "AccountMgr::GetRBACPermission: {}", permissionId);
569 rbac::RBACPermissionsContainer::const_iterator it = _permissions.find(permissionId);
570 if (it != _permissions.end())
571 return it->second;
572
573 return nullptr;
574}
575
576bool AccountMgr::HasPermission(uint32 accountId, uint32 permissionId, uint32 realmId)
577{
578 if (!accountId)
579 {
580 TC_LOG_ERROR("rbac", "AccountMgr::HasPermission: Wrong accountId 0");
581 return false;
582 }
583
584 rbac::RBACData rbac(accountId, "", realmId, GetSecurity(accountId, realmId));
585 rbac.LoadFromDB();
586 bool hasPermission = rbac.HasPermission(permissionId);
587
588 TC_LOG_DEBUG("rbac", "AccountMgr::HasPermission [AccountId: {}, PermissionId: {}, realmId: {}]: {}",
589 accountId, permissionId, realmId, hasPermission);
590 return hasPermission;
591}
592
594{
595 for (std::pair<uint32 const, rbac::RBACPermission*>& permission : _permissions)
596 delete permission.second;
597
598 _permissions.clear();
599 _defaultPermissions.clear();
600}
601
603{
604 TC_LOG_TRACE("rbac", "AccountMgr::GetRBACDefaultPermissions: secLevel {} - size: {}", secLevel, uint32(_defaultPermissions[secLevel].size()));
605 return _defaultPermissions[secLevel];
606}
Trinity::Crypto::SRP::GruntSRP6 AccountSRP6
#define MAX_ACCOUNT_STR
Definition AccountMgr.h:44
#define MAX_PASS_STR
Definition AccountMgr.h:43
#define MAX_EMAIL_STR
Definition AccountMgr.h:45
AccountOpResult
Definition AccountMgr.h:25
@ CHAR_DEL_CHARACTER_BAN
@ CHAR_DEL_TUTORIALS
@ CHAR_SEL_SUM_CHARS
@ CHAR_DEL_ACCOUNT_DATA
@ CHAR_SEL_CHARS_BY_ACCOUNT_ID
@ SEC_PLAYER
Definition Common.h:43
@ SEC_ADMINISTRATOR
Definition Common.h:46
@ SEC_CONSOLE
Definition Common.h:47
SQLTransaction< LoginDatabaseConnection > LoginDatabaseTransaction
std::shared_ptr< ResultSet > QueryResult
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:181
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:190
#define TC_LOG_INFO(filterType__, message__,...)
Definition Log.h:184
#define TC_LOG_TRACE(filterType__, message__,...)
Definition Log.h:178
@ LOGIN_GET_EMAIL_BY_ID
@ LOGIN_UPD_EMAIL
@ LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM
@ LOGIN_GET_ACCOUNT_ID_BY_USERNAME
@ LOGIN_UPD_REG_EMAIL
@ LOGIN_SEL_ACCOUNT_BY_ID
@ LOGIN_DEL_ACCOUNT_MUTED
@ LOGIN_DEL_ACCOUNT_BANNED
@ LOGIN_SEL_CHECK_PASSWORD_BY_NAME
@ LOGIN_DEL_ACCOUNT_ACCESS
@ LOGIN_UPD_USERNAME
@ LOGIN_GET_GMLEVEL_BY_REALMID
@ LOGIN_UPD_LOGON
@ LOGIN_GET_USERNAME_BY_ID
@ LOGIN_DEL_ACCOUNT
@ LOGIN_INS_REALM_CHARACTERS_INIT
@ LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME
@ LOGIN_INS_ACCOUNT_ACCESS
@ LOGIN_DEL_REALM_CHARACTERS
@ LOGIN_SEL_CHECK_PASSWORD
@ LOGIN_INS_ACCOUNT
#define sRealmList
Definition RealmList.h:93
#define sScriptMgr
Definition ScriptMgr.h:1449
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:57
uint32 getMSTime()
Definition Timer.h:33
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
Definition Util.cpp:752
size_t utf8length(std::string &utf8str)
Definition Util.cpp:302
static AccountOpResult ChangeRegEmail(uint32 accountId, std::string newEmail)
void LoadRBAC()
static AccountOpResult DeleteAccount(uint32 accountId)
AccountOpResult CreateAccount(std::string username, std::string password, std::string email="", uint32 bnetAccountId=0, uint8 bnetIndex=0)
rbac::RBACPermissionsContainer _permissions
Definition AccountMgr.h:100
static AccountOpResult ChangeEmail(uint32 accountId, std::string newEmail)
static uint32 GetSecurity(uint32 accountId, int32 realmId)
static AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword)
static uint32 GetCharactersCount(uint32 accountId)
void UpdateAccountAccess(rbac::RBACData *rbac, uint32 accountId, uint8 securityLevel, int32 realmId)
static bool IsPlayerAccount(uint32 gmlevel)
void ClearRBAC()
static AccountOpResult ChangePassword(uint32 accountId, std::string newPassword)
static QueryCallback GetSecurityAsync(uint32 accountId, int32 realmId, std::function< void(uint32)> callback)
static bool IsConsoleAccount(uint32 gmlevel)
static AccountMgr * instance()
rbac::RBACPermissionContainer const & GetRBACDefaultPermissions(uint8 secLevel)
static bool HasPermission(uint32 accountId, uint32 permission, uint32 realmId)
static bool CheckPassword(std::string username, std::string password)
static bool GetEmail(uint32 accountId, std::string &email)
rbac::RBACDefaultPermissionsContainer _defaultPermissions
Definition AccountMgr.h:101
static bool CheckEmail(uint32 accountId, std::string newEmail)
static bool IsBannedAccount(std::string const &name)
rbac::RBACPermission const * GetRBACPermission(uint32 permission) const
static bool IsAdminAccount(uint32 gmlevel)
static uint32 GetId(std::string_view username)
static bool GetName(uint32 accountId, std::string &name)
Class used to access individual fields of database query result.
Definition Field.h:94
uint32 GetUInt32() const noexcept
Definition Field.cpp:57
static void DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars=true, bool deleteFinally=false)
Definition Player.cpp:3767
void setBinary(uint8 index, std::vector< uint8 > &&value)
void setString(uint8 index, std::string &&value)
void setUInt32(uint8 index, uint32 value)
void setInt32(uint8 index, int32 value)
void setUInt8(uint8 index, uint8 value)
bool CheckCredentials(std::string const &username, std::string const &password) const
Definition SRP6.cpp:53
Player session in the World.
void LogoutPlayer(bool save)
Log the player out
void KickPlayer(std::string_view reason)
Kick a player out of the World.
void AddLinkedPermission(uint32 id)
Adds a new linked Permission.
Definition RBAC.h:789
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
std::array< uint8, SALT_LENGTH > Salt
Definition SRP6.h:33
std::vector< uint8 > Verifier
Definition SRP6.h:35
static constexpr size_t SALT_LENGTH
Definition SRP6.h:32
std::set< uint32 > RBACPermissionContainer
Definition RBAC.h:769