[mapguide-commits] r7832 - trunk/MgDev/Server/src/Services/Resource

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Sep 2 21:58:16 PDT 2013


Author: hubu
Date: 2013-09-02 21:58:16 -0700 (Mon, 02 Sep 2013)
New Revision: 7832

Modified:
   trunk/MgDev/Server/src/Services/Resource/ResourceHeaderManager.cpp
Log:
Submit on behalf of Andy Zhang.
Fix ticket#2326 http://trac.osgeo.org/mapguide/ticket/2346 Load package failed with DBXML error: Document not found. 

The error actually happens in method below: 
void MgResourceHeaderManager::DeleteDocument(MgResourceIdentifier& resource,
    XmlDocument& xmlDoc, XmlUpdateContext& updateContext)
{
    MG_RESOURCE_SERVICE_TRY()
    // Check if the current user is allowed to perform the current operation.
    CheckParentPermission(resource, MgResourcePermission::ReadWrite);
    // Delete the resource.
    MgResourceDefinitionManager::DeleteDocument(xmlDoc, updateContext);
    // Update the local permission cache.
    UpdatePermissionCache(MgResourceService::opIdDeleteResource,
        resource.ToString(), MgResourcePermission::ReadWrite, xmlDoc, false);

    MG_RESOURCE_SERVICE_CATCH_AND_THROW(L"MgResourceHeaderManager.DeleteDocument")
}

The resource is deleted in DeleteDocument call. But in the following UpdatePermissionCache call, it will try to get the document, which results in a 'Document not found' error. Now change the order of the 2 calls to fix the issue.
 

Modified: trunk/MgDev/Server/src/Services/Resource/ResourceHeaderManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/ResourceHeaderManager.cpp	2013-09-02 13:13:40 UTC (rev 7831)
+++ trunk/MgDev/Server/src/Services/Resource/ResourceHeaderManager.cpp	2013-09-03 04:58:16 UTC (rev 7832)
@@ -2878,15 +2878,15 @@
 
     CheckParentPermission(resource, MgResourcePermission::ReadWrite);
 
-    // Delete the resource.
-
-    MgResourceDefinitionManager::DeleteDocument(xmlDoc, updateContext);
-
     // Update the local permission cache.
 
     UpdatePermissionCache(MgResourceService::opIdDeleteResource,
         resource.ToString(), MgResourcePermission::ReadWrite, xmlDoc, false);
 
+    // Delete the resource.
+
+    MgResourceDefinitionManager::DeleteDocument(xmlDoc, updateContext);
+
     MG_RESOURCE_SERVICE_CATCH_AND_THROW(L"MgResourceHeaderManager.DeleteDocument")
 }
 



More information about the mapguide-commits mailing list