415 TC_LOG_DEBUG(
"rbac",
"AccountMgr::LoadRBAC: Loading permissions");
419 TC_LOG_INFO(
"server.loading",
">> Loaded 0 account permission definitions. DB table `rbac_permissions` is empty.");
425 Field* field = result->Fetch();
430 while (result->NextRow());
432 TC_LOG_DEBUG(
"rbac",
"AccountMgr::LoadRBAC: Loading linked permissions");
433 result =
LoginDatabase.
Query(
"SELECT id, linkedId FROM rbac_linked_permissions ORDER BY id ASC");
436 TC_LOG_INFO(
"server.loading",
">> Loaded 0 linked permissions. DB table `rbac_linked_permissions` is empty.");
445 Field* field = result->Fetch();
447 if (permissionId != newId)
449 permissionId = newId;
454 if (linkedPermissionId == permissionId)
456 TC_LOG_ERROR(
"sql.sql",
"RBAC Permission %u has itself as linked permission. Ignored", permissionId);
462 while (result->NextRow());
464 TC_LOG_DEBUG(
"rbac",
"AccountMgr::LoadRBAC: Loading default permissions");
465 result =
LoginDatabase.
PQuery(
"SELECT secId, permissionId FROM rbac_default_permissions WHERE (realmId = %u OR realmId = -1) ORDER BY secId ASC",
realm.
Id.
Realm);
468 TC_LOG_INFO(
"server.loading",
">> Loaded 0 default permission definitions. DB table `rbac_default_permissions` is empty.");
476 Field* field = result->Fetch();
478 if (secId != newId || permissions ==
NULL)
484 permissions->insert(field[1].GetUInt32());
487 while (result->NextRow());
489 TC_LOG_INFO(
"server.loading",
">> Loaded %u permission definitions, %u linked permissions and %u default permissions in %u ms", count1, count2, count3,
GetMSTimeDiffToNow(oldMSTime));
uint32 Realm
Definition: Realm.h:53
QueryResult PQuery(Format &&sql, T *conn, Args &&...args)
Definition: DatabaseWorkerPool.h:165
rbac::RBACDefaultPermissionsContainer _defaultPermissions
Definition: AccountMgr.h:95
void ClearRBAC()
Definition: AccountMgr.cpp:550
Realm realm
Definition: World.cpp:3485
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
void AddLinkedPermission(uint32 id)
Adds a new linked Permission.
Definition: RBAC.h:762
Battlenet::RealmHandle Id
Definition: Realm.h:86
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
std::set< uint32 > RBACPermissionContainer
Definition: RBAC.h:746
rbac::RBACPermissionsContainer _permissions
Definition: AccountMgr.h:94