Disallow modification of system folders. Prevent changing the type of folders

and prevent resetting the version number
0.6.9-post-fixes
Melanie 2010-09-02 00:00:54 +01:00
parent 2b4af70db0
commit d7086a776a
1 changed files with 16 additions and 1 deletions

View File

@ -270,13 +270,28 @@ namespace OpenSim.Services.InventoryService
public bool AddFolder(InventoryFolderBase folder) public bool AddFolder(InventoryFolderBase folder)
{ {
InventoryFolderBase check = GetFolder(folder);
if (check != null)
return false;
XInventoryFolder xFolder = ConvertFromOpenSim(folder); XInventoryFolder xFolder = ConvertFromOpenSim(folder);
return m_Database.StoreFolder(xFolder); return m_Database.StoreFolder(xFolder);
} }
public bool UpdateFolder(InventoryFolderBase folder) public bool UpdateFolder(InventoryFolderBase folder)
{ {
return AddFolder(folder); XInventoryFolder xFolder = ConvertFromOpenSim(folder);
InventoryFolderBase check = GetFolder(folder);
if (check == null)
return AddFolder(folder);
if (check.Type != -1 || xFolder.type != -1)
return false;
xFolder.version = check.Version;
xFolder.folderID = check.ID;
return m_Database.StoreFolder(xFolder);
} }
public bool MoveFolder(InventoryFolderBase folder) public bool MoveFolder(InventoryFolderBase folder)