Skip to content

Commit dd5b38e

Browse files
committed
Revert "Fix ACL request detection when using refresh (multitheftauto#1824) (multitheftauto#4409)"
This reverts commit d0e210a.
1 parent da8e500 commit dd5b38e

File tree

4 files changed

+4
-74
lines changed

4 files changed

+4
-74
lines changed

Server/mods/deathmatch/logic/CResource.AclRequest.cpp

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ bool CResource::HasAutoPermissions(CXMLNode* pNodeAclRequest)
123123
///////////////////////////////////////////////////////////////
124124
void CResource::RefreshAutoPermissions(CXMLNode* pNodeAclRequest)
125125
{
126+
// Check if permissions already active
127+
if (HasAutoPermissions(pNodeAclRequest))
128+
return;
126129

127130
// Ensure group and acl exist
128131
CAccessControlListGroup* pAutoGroup = g_pGame->GetACLManager()->AddGroup(GetAutoGroupName());
@@ -369,51 +372,3 @@ bool CResource::FindAclRequest(SAclRequest& result)
369372

370373
return pAclRight->GetAttributeValue("pending") != "";
371374
}
372-
373-
std::string CResource::CalculateACLRequestFingerprint()
374-
{
375-
std::string strPath;
376-
if (!GetFilePath("meta.xml", strPath))
377-
return {};
378-
379-
std::unique_ptr<CXMLFile> metaFile(g_pServerInterface->GetXML()->CreateXML(strPath.c_str()));
380-
if (!metaFile || !metaFile->Parse())
381-
{
382-
return {};
383-
}
384-
385-
CXMLNode* root = metaFile->GetRootNode();
386-
if (!root)
387-
{
388-
return {};
389-
}
390-
391-
std::ostringstream fingerprint;
392-
CXMLNode* nodeAclRequest = root->FindSubNode("aclrequest", 0);
393-
394-
if (nodeAclRequest)
395-
{
396-
for (std::uint8_t uiIndex = 0; true; uiIndex++)
397-
{
398-
CXMLNode* nodeRight = nodeAclRequest->FindSubNode("right", uiIndex);
399-
if (!nodeRight)
400-
break;
401-
402-
std::string strName = nodeRight->GetAttributeValue("name");
403-
std::string strAccess = nodeRight->GetAttributeValue("access");
404-
405-
if (uiIndex > 0)
406-
fingerprint << ";";
407-
408-
fingerprint << strName << ":" << strAccess;
409-
}
410-
}
411-
412-
return fingerprint.str();
413-
}
414-
415-
bool CResource::HasACLRequestsChanged()
416-
{
417-
std::string strCurrentFingerprint = CalculateACLRequestFingerprint();
418-
return strCurrentFingerprint != m_strACLRequestFingerprint;
419-
}

Server/mods/deathmatch/logic/CResource.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ bool CResource::Load()
196196
else
197197
RemoveAutoPermissions();
198198

199-
m_strACLRequestFingerprint = CalculateACLRequestFingerprint();
200-
201199
// Find any map sync option
202200
m_bSyncMapElementData = true;
203201
m_bSyncMapElementDataDefined = false;
@@ -353,7 +351,6 @@ bool CResource::Unload()
353351
m_strResourceZip = "";
354352
m_strResourceCachePath = "";
355353
m_strResourceDirectoryPath = "";
356-
m_strACLRequestFingerprint.clear();
357354
m_eState = EResourceState::None;
358355

359356
return true;
@@ -405,8 +402,6 @@ CResource::~CResource()
405402

406403
void CResource::TidyUp()
407404
{
408-
RemoveAutoPermissions();
409-
410405
// Close the zipfile stuff
411406
if (m_zipfile)
412407
unzClose(m_zipfile);
@@ -683,11 +678,6 @@ bool CResource::HasResourceChanged()
683678
return true;
684679
}
685680

686-
if (HasACLRequestsChanged())
687-
{
688-
return true;
689-
}
690-
691681
return false;
692682
}
693683

@@ -1205,9 +1195,6 @@ bool CResource::Stop(bool bManualStop)
12051195
// Clear the list of players where this resource is running
12061196
std::exchange(m_isRunningForPlayer, {});
12071197

1208-
// Remove ACL permissions when stopping
1209-
RemoveAutoPermissions();
1210-
12111198
OnResourceStateChange("loaded");
12121199
m_eState = EResourceState::Loaded;
12131200
return true;

Server/mods/deathmatch/logic/CResource.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,7 @@ class CResource : public EHS
347347
void RefreshAutoPermissions(CXMLNode* pNodeAclRequest);
348348

349349
void CommitAclRequest(const SAclRequest& request);
350-
bool FindAclRequest(SAclRequest& result);
351-
352-
std::string CalculateACLRequestFingerprint();
353-
bool HasACLRequestsChanged();
350+
bool FindAclRequest(SAclRequest& request);
354351

355352
private:
356353
bool CheckState(); // if the resource has no Dependents, stop it, if it has, start it. returns true if the resource is started.
@@ -453,7 +450,6 @@ class CResource : public EHS
453450
SString m_strMinServerReason;
454451

455452
CChecksum m_metaChecksum; // Checksum of meta.xml last time this was loaded, generated in GenerateChecksums()
456-
std::string m_strACLRequestFingerprint;
457453

458454
uint m_uiFunctionRightCacheRevision = 0;
459455
CFastHashMap<lua_CFunction, bool> m_FunctionRightCacheMap;

Server/mods/deathmatch/logic/CResourceManager.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,6 @@ bool CResourceManager::Refresh(bool bRefreshAll, const SString strJustThisResour
184184
// Add the resource
185185
Load(!info.bIsDir, info.strAbsPath, info.strName);
186186
}
187-
else if (bRefreshAll && pResource && pResource->HasResourceChanged())
188-
{
189-
if (g_pServerInterface->IsRequestingExit())
190-
return false;
191-
192-
// Resource exists but has changed, reload it
193-
Load(!info.bIsDir, info.strAbsPath, info.strName);
194-
}
195187
}
196188
}
197189

0 commit comments

Comments
 (0)