Skip to content
Permalink
Browse files

Add users to ACL read cache

  • Loading branch information
ccw808 committed Jan 1, 2020
1 parent ae4415a commit 95e1e9e6c5c9a8088a0f21eaa7a2e4fc53ab5f50
Showing with 11 additions and 16 deletions.
  1. +11 −16 Server/mods/deathmatch/logic/CAccessControlListManager.cpp
@@ -328,24 +328,19 @@ bool CAccessControlListManager::CanObjectUseRight(const char* szObjectName, CAcc
if (m_bReadCacheDirty)
ClearReadCache();

// If object is resource, try cache
if (eObjectType == CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE)
// Make unique key for this query
SString strKey("%s %s %d %d %d", szObjectName, szRightName, eObjectType, eRightType, bDefaultAccessRight);
// Check if this query has been done before
bool* pResult = MapFind(m_ReadCacheMap, strKey);
if (!pResult)
{
// Make unique key for this query
SString strKey("%s %s %d %d", szObjectName, szRightName, eRightType, bDefaultAccessRight);
// Check if this query has been done before
bool* pResult = MapFind(m_ReadCacheMap, strKey);
if (!pResult)
{
// If not, do query now and add result to the cache
bool bResult = InternalCanObjectUseRight(szObjectName, eObjectType, szRightName, eRightType, bDefaultAccessRight);
MapSet(m_ReadCacheMap, strKey, bResult);
pResult = MapFind(m_ReadCacheMap, strKey);
}
// Return cached result
return *pResult;
// If not, do query now and add result to the cache
bool bResult = InternalCanObjectUseRight(szObjectName, eObjectType, szRightName, eRightType, bDefaultAccessRight);
MapSet(m_ReadCacheMap, strKey, bResult);
return bResult;
}
return InternalCanObjectUseRight(szObjectName, eObjectType, szRightName, eRightType, bDefaultAccessRight);
// Return cached result
return *pResult;
}

bool CAccessControlListManager::InternalCanObjectUseRight(const char* szObjectName, CAccessControlListGroupObject::EObjectType eObjectType,

0 comments on commit 95e1e9e

Please sign in to comment.
You can’t perform that action at this time.