Core/Misc: Avoid heap allocation when performing some RBAC checks
This commit is contained in:
1 parent
d76d3def64
commit
f245124127
4 files changed
+6
-6
No files matched your search
@@ -549,10 +549,9 @@ bool AccountMgr::HasPermission(uint32 accountId, uint32 permissionId, uint32 rea
|
||||
return false;
|
||||
}
|
||||
|
||||
RBACData* rbac = new RBACData(accountId, "", realmId);
|
||||
rbac->LoadFromDB();
|
||||
bool hasPermission = rbac->HasPermission(permissionId);
|
||||
delete rbac;
|
||||
RBACData rbac(accountId, "", realmId);
|
||||
rbac.LoadFromDB();
|
||||
bool hasPermission = rbac.HasPermission(permissionId);
|
||||
|
||||
TC_LOG_DEBUG(LOG_FILTER_RBAC, "AccountMgr::HasPermission [AccountId: %u, PermissionId: %u, realmId: %d]: %u",
|
||||
accountId, permissionId, realmId, hasPermission);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "RBAC.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
|
||||
void RBACRole::GrantPermission(uint32 permissionId)
|
||||
{
|
||||
|
||||
@@ -213,7 +213,7 @@ class RBACData: public RBACObject
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
bool HasPermission(uint32 permission) { return _globalPerms.test(permission); }
|
||||
bool HasPermission(uint32 permission) const { return _globalPerms.test(permission); }
|
||||
|
||||
// Functions enabled to be used by command system
|
||||
/// Returns all the granted permissions (after computation)
|
||||
|
||||
@@ -447,7 +447,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
|
||||
void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const std::string& comment)
|
||||
{
|
||||
if (!player || !player->GetSession() || dungeons.empty())
|
||||
return;
|
||||
return;
|
||||
|
||||
Group* grp = player->GetGroup();
|
||||
uint64 guid = player->GetGUID();
|
||||
|
||||
Reference in new issue
Block a user