aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-22 12:52:56 +0000
committerMelanie Thielker2008-09-22 12:52:56 +0000
commitd7a98925ce5693f28ef48e4228680f3a7aba12af (patch)
tree2e20488ce767f98b586593b434d21e0b9e398d27
parentcleanups in inventory REST code. also, disables digest authentications (diff)
downloadopensim-SC_OLD-d7a98925ce5693f28ef48e4228680f3a7aba12af.zip
opensim-SC_OLD-d7a98925ce5693f28ef48e4228680f3a7aba12af.tar.gz
opensim-SC_OLD-d7a98925ce5693f28ef48e4228680f3a7aba12af.tar.bz2
opensim-SC_OLD-d7a98925ce5693f28ef48e4228680f3a7aba12af.tar.xz
Create CanEditObjectInventory to preserve the ability
to have different permissions on inventory and object edits. This may be needed by the viewer on public grids
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs28
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs27
3 files changed, 49 insertions, 26 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 3b4819b..1a36315 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -163,6 +163,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
163 m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED 163 m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED
164 m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED 164 m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED
165 m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED 165 m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED
166 m_scene.ExternalChecks.addCheckEditObject(CanEditObjectInventory);//MAYBE FULLY IMPLEMENTED
166 m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED 167 m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED
167 m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED 168 m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED
168 m_scene.ExternalChecks.addCheckEditNotecard(CanEditNotecard); //NOT YET IMPLEMENTED 169 m_scene.ExternalChecks.addCheckEditNotecard(CanEditNotecard); //NOT YET IMPLEMENTED
@@ -602,6 +603,25 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
602 return GenericObjectPermission(editorID, objectID, false); 603 return GenericObjectPermission(editorID, objectID, false);
603 } 604 }
604 605
606 private bool CanEditObjectInventory(UUID objectID, UUID editorID, Scene scene)
607 {
608 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
609 if (m_bypassPermissions) return m_bypassPermissionsValue;
610
611 SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
612
613 // Commented because this behavior causes issues for IBM
614 // With this commented, strange viewer issues can be observed
615 // when trying to edit scripts and/or notecards in
616 // "Hacked god mode"
617 // TODO: add group support!
618 //
619// if(part.OwnerID != editorID)
620// return false;
621
622 return GenericObjectPermission(editorID, objectID, false);
623 }
624
605 private bool CanEditParcel(UUID user, ILandObject parcel, Scene scene) 625 private bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
606 { 626 {
607 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 627 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index a188701..a1c5fe7 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1186,18 +1186,7 @@ namespace OpenSim.Region.Environment.Scenes
1186 1186
1187 if (part != null) 1187 if (part != null)
1188 { 1188 {
1189 1189 if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId))
1190 // replacing the following two checks with the
1191 // ExternalChecks.ExternalChecksCanEditObject(...)
1192 // call
1193
1194 // if (part.OwnerID != remoteClient.AgentId)
1195 // return;
1196
1197 // if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
1198 // return;
1199
1200 if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId))
1201 { 1190 {
1202 return; 1191 return;
1203 } 1192 }
@@ -1293,20 +1282,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T
1293 SceneObjectPart part = GetSceneObjectPart(localID); 1282 SceneObjectPart part = GetSceneObjectPart(localID);
1294 if (part != null) 1283 if (part != null)
1295 { 1284 {
1296 1285 if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId))
1297 /*
1298 if (part.OwnerID != remoteClient.AgentId)
1299 {
1300 return;
1301 }
1302
1303 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
1304 {
1305 return;
1306 }
1307 */
1308
1309 if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId))
1310 { 1286 {
1311 return; 1287 return;
1312 } 1288 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index 678d707..f8d041a 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -343,6 +343,33 @@ namespace OpenSim.Region.Environment.Scenes
343 return true; 343 return true;
344 } 344 }
345 345
346 public delegate bool CanEditObjectInventory(UUID objectID, UUID editorID, Scene scene);
347 private List<CanEditObjectInventory> CanEditObjectInventoryCheckFunctions = new List<CanEditObjectInventory>();
348
349 public void addCheckEditObjectInventory(CanEditObjectInventory delegateFunc)
350 {
351 if (!CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
352 CanEditObjectInventoryCheckFunctions.Add(delegateFunc);
353 }
354
355 public void removeCheckEditObjectInventory(CanEditObjectInventory delegateFunc)
356 {
357 if (CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
358 CanEditObjectInventoryCheckFunctions.Remove(delegateFunc);
359 }
360
361 public bool ExternalChecksCanEditObjectInventory(UUID objectID, UUID editorID)
362 {
363 foreach (CanEditObjectInventory check in CanEditObjectInventoryCheckFunctions)
364 {
365 if (check(objectID, editorID, m_scene) == false)
366 {
367 return false;
368 }
369 }
370 return true;
371 }
372
346 #endregion 373 #endregion
347 374
348 #region MOVE OBJECT 375 #region MOVE OBJECT