diff options
| author | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-02-18 18:51:52 +0100 |
|---|---|---|
| committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-02-18 18:51:52 +0100 |
| commit | 71eaceae5de6cc1c517bec78d0ef52e149a59b6e (patch) | |
| tree | a89711c8f03305f36b6042efa8eb5c5b104c2fad /src/server/game/Accounts/AccountMgr.cpp | |
| parent | 2277f6db44a4dabf98611189d8d75df3a0008a66 (diff) | |
| parent | 1c745dfe16787f9b51310c07b5b3c6801e9592e5 (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Entities/Vehicle/Vehicle.cpp
src/server/game/Globals/ObjectMgr.cpp
src/server/game/Spells/SpellMgr.cpp
src/server/game/Weather/Weather.h
src/server/shared/Database/Implementation/WorldDatabase.cpp
src/tools/CMakeLists.txt
Diffstat (limited to 'src/server/game/Accounts/AccountMgr.cpp')
| -rw-r--r-- | src/server/game/Accounts/AccountMgr.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index b1d0087c32c..bd560c8266e 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -1,4 +1,4 @@ -/* + /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * @@ -56,7 +56,7 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass RBACData* rbac = new RBACData(GetId(username), username, -1); // No need to Load From DB, as it's new data - RBACGroupContainer const& groupsToAdd = _defaultGroups[0]; // 0: Default sec level + RBACGroupContainer const& groupsToAdd = _defaultSecGroups[0]; // 0: Default sec level for (RBACGroupContainer::const_iterator it = groupsToAdd.begin(); it != groupsToAdd.end(); ++it) rbac->AddGroup(*it, -1); @@ -426,13 +426,23 @@ void AccountMgr::LoadRBAC() uint8 secId = field[0].GetUInt8(); if (lastSecId != secId) - groups = &_defaultGroups[secId]; + groups = &_defaultSecGroups[secId]; groups->insert(field[1].GetUInt32()); } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u permission definitions, %u role definitions and %u group definitions in %u ms", count1, count2, count3, GetMSTimeDiffToNow(oldMSTime)); + + // Load default groups to be added to any RBAC Object. + std::string defaultGroups = ConfigMgr::GetStringDefault("RBAC.DefaultGroups", ""); + Tokenizer tokens(defaultGroups, ','); + for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr) + if (uint32 groupId = atoi(*itr)) + { + sLog->outError(LOG_FILTER_LFG, "Adding default group %u", groupId); + _defaultGroups.insert(groupId); + } } void AccountMgr::UpdateAccountAccess(RBACData* rbac, uint32 accountId, uint8 securityLevel, int32 realmId) @@ -459,7 +469,7 @@ void AccountMgr::UpdateAccountAccess(RBACData* rbac, uint32 accountId, uint8 sec uint8 secLevel = field[0].GetUInt8(); int32 realmId = field[1].GetUInt32(); - RBACGroupContainer const& groupsToRemove = _defaultGroups[secLevel]; + RBACGroupContainer const& groupsToRemove = _defaultSecGroups[secLevel]; for (RBACGroupContainer::const_iterator it = groupsToRemove.begin(); it != groupsToRemove.end(); ++it) rbac->RemoveGroup(*it, realmId); } @@ -467,7 +477,7 @@ void AccountMgr::UpdateAccountAccess(RBACData* rbac, uint32 accountId, uint8 sec } // Add new groups depending on the new security Level - RBACGroupContainer const& groupsToAdd = _defaultGroups[securityLevel]; + RBACGroupContainer const& groupsToAdd = _defaultSecGroups[securityLevel]; for (RBACGroupContainer::const_iterator it = groupsToAdd.begin(); it != groupsToAdd.end(); ++it) rbac->AddGroup(*it, realmId); |
