aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-14 17:13:04 +0100
committerJustin Clark-Casey (justincc)2010-07-14 17:13:04 +0100
commit0080c3b1f4467224885323e7198c91d7e221f75b (patch)
tree82fcfd5dd7fd3c9df8c467e5a423b792357384b3 /OpenSim/Region
parentFix obvious bug in XInventoryService.GetFolderItems() which was preventing th... (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-0080c3b1f4467224885323e7198c91d7e221f75b.zip
opensim-SC_OLD-0080c3b1f4467224885323e7198c91d7e221f75b.tar.gz
opensim-SC_OLD-0080c3b1f4467224885323e7198c91d7e221f75b.tar.bz2
opensim-SC_OLD-0080c3b1f4467224885323e7198c91d7e221f75b.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs53
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs141
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs1
-rw-r--r--OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs7
8 files changed, 179 insertions, 104 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 2057c65..1a7da61 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -381,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
381 if ((nextPerms & (uint)PermissionMask.Modify) == 0) 381 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
382 perms &= ~(uint)PermissionMask.Modify; 382 perms &= ~(uint)PermissionMask.Modify;
383 383
384 // Make sure all bits but the ones we want are clear
385 // on take.
386 // This will be applied to the current perms, so
387 // it will do what we want.
388 objectGroup.RootPart.NextOwnerMask &=
389 ((uint)PermissionMask.Copy |
390 (uint)PermissionMask.Transfer |
391 (uint)PermissionMask.Modify);
392 objectGroup.RootPart.NextOwnerMask |=
393 (uint)PermissionMask.Move;
394
384 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; 395 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
385 item.CurrentPermissions = item.BasePermissions; 396 item.CurrentPermissions = item.BasePermissions;
386 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 397 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
387 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; 398 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
388 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; 399 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
389 item.CurrentPermissions |= 8; // Slam! 400
401 // Magic number badness. Maybe this deserves an enum.
402 // bit 4 (16) is the "Slam" bit, it means treat as passed
403 // and apply next owner perms on rez
404 item.CurrentPermissions |= 16; // Slam!
390 } 405 }
391 else 406 else
392 { 407 {
@@ -396,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
396 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 411 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
397 item.GroupPermissions = objectGroup.RootPart.GroupMask; 412 item.GroupPermissions = objectGroup.RootPart.GroupMask;
398 413
399 item.CurrentPermissions |= 8; // Slam! 414 item.CurrentPermissions &=
415 ((uint)PermissionMask.Copy |
416 (uint)PermissionMask.Transfer |
417 (uint)PermissionMask.Modify |
418 (uint)PermissionMask.Move |
419 7); // Preserve folded permissions
400 } 420 }
401 421
402 // TODO: add the new fields (Flags, Sale info, etc) 422 // TODO: add the new fields (Flags, Sale info, etc)
@@ -499,6 +519,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
499 519
500 group.RootPart.FromFolderID = item.Folder; 520 group.RootPart.FromFolderID = item.Folder;
501 521
522 // If it's rezzed in world, select it. Much easier to
523 // find small items.
524 //
525 if (!attachment)
526 group.RootPart.CreateSelected = true;
527
502 if (!m_Scene.Permissions.CanRezObject( 528 if (!m_Scene.Permissions.CanRezObject(
503 group.Children.Count, remoteClient.AgentId, pos) 529 group.Children.Count, remoteClient.AgentId, pos)
504 && !attachment) 530 && !attachment)
@@ -571,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
571 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 597 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
572 598
573 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 599 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
574 if (rootPart.OwnerID != item.Owner) 600 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
575 { 601 {
576 //Need to kill the for sale here 602 //Need to kill the for sale here
577 rootPart.ObjectSaleType = 0; 603 rootPart.ObjectSaleType = 0;
@@ -579,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
579 605
580 if (m_Scene.Permissions.PropagatePermissions()) 606 if (m_Scene.Permissions.PropagatePermissions())
581 { 607 {
582 if ((item.CurrentPermissions & 8) != 0) 608 foreach (SceneObjectPart part in partList)
583 { 609 {
584 foreach (SceneObjectPart part in partList) 610 part.EveryoneMask = item.EveryOnePermissions;
585 { 611 part.NextOwnerMask = item.NextPermissions;
586 part.EveryoneMask = item.EveryOnePermissions; 612 part.GroupMask = 0; // DO NOT propagate here
587 part.NextOwnerMask = item.NextPermissions;
588 part.GroupMask = 0; // DO NOT propagate here
589 }
590 } 613 }
591 614
592 group.ApplyNextOwnerPermissions(); 615 group.ApplyNextOwnerPermissions();
@@ -595,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
595 618
596 foreach (SceneObjectPart part in partList) 619 foreach (SceneObjectPart part in partList)
597 { 620 {
598 if (part.OwnerID != item.Owner) 621 if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
599 { 622 {
600 part.LastOwnerID = part.OwnerID; 623 part.LastOwnerID = part.OwnerID;
601 part.OwnerID = item.Owner; 624 part.OwnerID = item.Owner;
602 part.Inventory.ChangeInventoryOwner(item.Owner); 625 part.Inventory.ChangeInventoryOwner(item.Owner);
603 }
604 else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
605 {
606 part.EveryoneMask = item.EveryOnePermissions;
607 part.NextOwnerMask = item.NextPermissions;
608
609 part.GroupMask = 0; // DO NOT propagate here 626 part.GroupMask = 0; // DO NOT propagate here
610 } 627 }
628 part.EveryoneMask = item.EveryOnePermissions;
629 part.NextOwnerMask = item.NextPermissions;
611 } 630 }
612 631
613 rootPart.TrimPermissions(); 632 rootPart.TrimPermissions();
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 4ec5253..97161fc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
253 253
254 public InventoryFolderBase GetRootFolder(UUID userID) 254 public InventoryFolderBase GetRootFolder(UUID userID)
255 { 255 {
256 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); 256 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
257 257
258 string invURL = GetInventoryServiceURL(userID); 258 string invURL = GetInventoryServiceURL(userID);
259 259
@@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
267 267
268 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 268 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
269 { 269 {
270 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); 270 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
271 271
272 string invURL = GetInventoryServiceURL(userID); 272 string invURL = GetInventoryServiceURL(userID);
273 273
@@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
281 281
282 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 282 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
283 { 283 {
284 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID); 284 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
285 285
286 string invURL = GetInventoryServiceURL(userID); 286 string invURL = GetInventoryServiceURL(userID);
287 287
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
296 296
297 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 297 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
298 { 298 {
299 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID); 299 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
300 300
301 string invURL = GetInventoryServiceURL(userID); 301 string invURL = GetInventoryServiceURL(userID);
302 302
@@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
314 if (folder == null) 314 if (folder == null)
315 return false; 315 return false;
316 316
317 m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID); 317 //m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
318 318
319 string invURL = GetInventoryServiceURL(folder.Owner); 319 string invURL = GetInventoryServiceURL(folder.Owner);
320 320
@@ -331,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
331 if (folder == null) 331 if (folder == null)
332 return false; 332 return false;
333 333
334 m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID); 334 //m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
335 335
336 string invURL = GetInventoryServiceURL(folder.Owner); 336 string invURL = GetInventoryServiceURL(folder.Owner);
337 337
@@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
350 if (folderIDs.Count == 0) 350 if (folderIDs.Count == 0)
351 return false; 351 return false;
352 352
353 m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID); 353 //m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
354 354
355 string invURL = GetInventoryServiceURL(ownerID); 355 string invURL = GetInventoryServiceURL(ownerID);
356 356
@@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
367 if (folder == null) 367 if (folder == null)
368 return false; 368 return false;
369 369
370 m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner); 370 //m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
371 371
372 string invURL = GetInventoryServiceURL(folder.Owner); 372 string invURL = GetInventoryServiceURL(folder.Owner);
373 373
@@ -384,7 +384,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
384 if (folder == null) 384 if (folder == null)
385 return false; 385 return false;
386 386
387 m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner); 387 //m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
388 388
389 string invURL = GetInventoryServiceURL(folder.Owner); 389 string invURL = GetInventoryServiceURL(folder.Owner);
390 390
@@ -401,7 +401,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
401 if (item == null) 401 if (item == null)
402 return false; 402 return false;
403 403
404 m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID); 404 //m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
405 405
406 string invURL = GetInventoryServiceURL(item.Owner); 406 string invURL = GetInventoryServiceURL(item.Owner);
407 407
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
418 if (item == null) 418 if (item == null)
419 return false; 419 return false;
420 420
421 m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID); 421 //m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
422 422
423 string invURL = GetInventoryServiceURL(item.Owner); 423 string invURL = GetInventoryServiceURL(item.Owner);
424 424
@@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
437 if (items.Count == 0) 437 if (items.Count == 0)
438 return true; 438 return true;
439 439
440 m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID); 440 //m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
441 441
442 string invURL = GetInventoryServiceURL(ownerID); 442 string invURL = GetInventoryServiceURL(ownerID);
443 443
@@ -451,15 +451,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
451 451
452 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) 452 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
453 { 453 {
454 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); 454 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
455 455
456 if (itemIDs == null) 456 if (itemIDs == null)
457 return false; 457 return false;
458 if (itemIDs.Count == 0) 458 if (itemIDs.Count == 0)
459 return true; 459 return true;
460 460
461 m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID);
462
463 string invURL = GetInventoryServiceURL(ownerID); 461 string invURL = GetInventoryServiceURL(ownerID);
464 462
465 if (invURL == null) // not there, forward to local inventory connector to resolve 463 if (invURL == null) // not there, forward to local inventory connector to resolve
@@ -474,7 +472,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
474 { 472 {
475 if (item == null) 473 if (item == null)
476 return null; 474 return null;
477 m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); 475 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
478 476
479 string invURL = GetInventoryServiceURL(item.Owner); 477 string invURL = GetInventoryServiceURL(item.Owner);
480 478
@@ -491,7 +489,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
491 if (folder == null) 489 if (folder == null)
492 return null; 490 return null;
493 491
494 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID); 492 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
495 493
496 string invURL = GetInventoryServiceURL(folder.Owner); 494 string invURL = GetInventoryServiceURL(folder.Owner);
497 495
@@ -515,7 +513,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
515 513
516 public int GetAssetPermissions(UUID userID, UUID assetID) 514 public int GetAssetPermissions(UUID userID, UUID assetID)
517 { 515 {
518 m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID); 516 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
519 517
520 string invURL = GetInventoryServiceURL(userID); 518 string invURL = GetInventoryServiceURL(userID);
521 519
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 3945142..2a87da2 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
146 else 146 else
147 { 147 {
148 // Normal Calculations 148 // Normal Calculations
149 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.objectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 149 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
150 } 150 }
151 } 151 }
152 public int GetSimulatorMaxPrimCount(ILandObject thisObject) 152 public int GetSimulatorMaxPrimCount(ILandObject thisObject)
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Land
158 else 158 else
159 { 159 {
160 //Normal Calculations 160 //Normal Calculations
161 return m_scene.objectCapacity; 161 return m_scene.RegionInfo.ObjectCapacity;
162 } 162 }
163 } 163 }
164 #endregion 164 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9ba13ae..2578685 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes
265 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, 265 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
266 UUID itemID, InventoryItemBase itemUpd) 266 UUID itemID, InventoryItemBase itemUpd)
267 { 267 {
268 // This one will let people set next perms on items in agent
269 // inventory. Rut-Roh. Whatever. Make this secure. Yeah.
270 //
271 // Passing something to another avatar or a an object will already
268 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 272 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
269 item = InventoryService.GetItem(item); 273 item = InventoryService.GetItem(item);
270 274
@@ -274,11 +278,9 @@ namespace OpenSim.Region.Framework.Scenes
274 { 278 {
275 item.Name = itemUpd.Name; 279 item.Name = itemUpd.Name;
276 item.Description = itemUpd.Description; 280 item.Description = itemUpd.Description;
277 item.NextPermissions = itemUpd.NextPermissions; 281 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
278 item.CurrentPermissions |= 8; // Slam! 282 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
279 item.EveryOnePermissions = itemUpd.EveryOnePermissions; 283 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
280 item.GroupPermissions = itemUpd.GroupPermissions;
281
282 item.GroupID = itemUpd.GroupID; 284 item.GroupID = itemUpd.GroupID;
283 item.GroupOwned = itemUpd.GroupOwned; 285 item.GroupOwned = itemUpd.GroupOwned;
284 item.CreationDate = itemUpd.CreationDate; 286 item.CreationDate = itemUpd.CreationDate;
@@ -384,28 +386,103 @@ namespace OpenSim.Region.Framework.Scenes
384 386
385 if (Permissions.PropagatePermissions() && recipient != senderId) 387 if (Permissions.PropagatePermissions() && recipient != senderId)
386 { 388 {
387 // First, make sore base is limited to the next perms 389 // Trying to do this right this time. This is evil. If
388 itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move); 390 // you believe in Good, go elsewhere. Vampires and other
389 // By default, current equals base 391 // evil creatores only beyond this point. You have been
390 itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions; 392 // warned.
391 393
392 // If this is an object, replace current perms 394 // We're going to mask a lot of things by the next perms
393 // with folded perms 395 // Tweak the next perms to be nicer to our data
396 //
397 // In this mask, all the bits we do NOT want to mess
398 // with are set. These are:
399 //
400 // Transfer
401 // Copy
402 // Modufy
403 uint permsMask = ~ ((uint)PermissionMask.Copy |
404 (uint)PermissionMask.Transfer |
405 (uint)PermissionMask.Modify);
406
407 // Now, reduce the next perms to the mask bits
408 // relevant to the operation
409 uint nextPerms = permsMask | (item.NextPermissions &
410 ((uint)PermissionMask.Copy |
411 (uint)PermissionMask.Transfer |
412 (uint)PermissionMask.Modify));
413
414 // nextPerms now has all bits set, except for the actual
415 // next permission bits.
416
417 // This checks for no mod, no copy, no trans.
418 // This indicates an error or messed up item. Do it like
419 // SL and assume trans
420 if (nextPerms == permsMask)
421 nextPerms |= (uint)PermissionMask.Transfer;
422
423 // Inventory owner perms are the logical AND of the
424 // folded perms and the root prim perms, however, if
425 // the root prim is mod, the inventory perms will be
426 // mod. This happens on "take" and is of little concern
427 // here, save for preventing escalation
428
429 // This hack ensures that items previously permalocked
430 // get unlocked when they're passed or rezzed
431 uint basePerms = item.BasePermissions |
432 (uint)PermissionMask.Move;
433 uint ownerPerms = item.CurrentPermissions;
434
435 // If this is an object, root prim perms may be more
436 // permissive than folded perms. Use folded perms as
437 // a mask
394 if (item.InvType == (int)InventoryType.Object) 438 if (item.InvType == (int)InventoryType.Object)
395 { 439 {
396 itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); 440 // Create a safe mask for the current perms
397 itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13; 441 uint foldedPerms = (item.CurrentPermissions & 7) << 13;
442 foldedPerms |= permsMask;
443
444 bool isRootMod = (item.CurrentPermissions &
445 (uint)PermissionMask.Modify) != 0 ?
446 true : false;
447
448 // Mask the owner perms to the folded perms
449 ownerPerms &= foldedPerms;
450 basePerms &= foldedPerms;
451
452 // If the root was mod, let the mask reflect that
453 // We also need to adjust the base here, because
454 // we should be able to edit in-inventory perms
455 // for the root prim, if it's mod.
456 if (isRootMod)
457 {
458 ownerPerms |= (uint)PermissionMask.Modify;
459 basePerms |= (uint)PermissionMask.Modify;
460 }
398 } 461 }
399 462
400 // Ensure there is no escalation 463 // These will be applied to the root prim at next rez.
401 itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move); 464 // The slam bit (bit 3) and folded permission (bits 0-2)
465 // are preserved due to the above mangling
466 ownerPerms &= nextPerms;
467
468 // Mask the base permissions. This is a conservative
469 // approach altering only the three main perms
470 basePerms &= nextPerms;
402 471
403 // Need slam bit on xfer 472 // Assign to the actual item. Make sure the slam bit is
404 itemCopy.CurrentPermissions |= 8; 473 // set, if it wasn't set before.
474 itemCopy.BasePermissions = basePerms;
475 itemCopy.CurrentPermissions = ownerPerms | 16; // Slam
405 476
406 itemCopy.NextPermissions = item.NextPermissions; 477 itemCopy.NextPermissions = item.NextPermissions;
407 478
408 itemCopy.EveryOnePermissions = 0; 479 // This preserves "everyone can move"
480 itemCopy.EveryOnePermissions = item.EveryOnePermissions &
481 nextPerms;
482
483 // Intentionally killing "share with group" here, as
484 // the recipient will not have the group this is
485 // set to
409 itemCopy.GroupPermissions = 0; 486 itemCopy.GroupPermissions = 0;
410 } 487 }
411 else 488 else
@@ -903,7 +980,7 @@ namespace OpenSim.Region.Framework.Scenes
903 else 980 else
904 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 981 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
905 982
906 agentItem.CurrentPermissions |= 8; 983 agentItem.CurrentPermissions |= 16; // Slam
907 agentItem.NextPermissions = taskItem.NextPermissions; 984 agentItem.NextPermissions = taskItem.NextPermissions;
908 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 985 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
909 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 986 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
@@ -1094,7 +1171,7 @@ namespace OpenSim.Region.Framework.Scenes
1094 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1171 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1095 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1172 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1096 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1173 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1097 destTaskItem.CurrentPermissions |= 8; // Slam! 1174 destTaskItem.CurrentPermissions |= 16; // Slam!
1098 } 1175 }
1099 } 1176 }
1100 1177
@@ -1478,7 +1555,7 @@ namespace OpenSim.Region.Framework.Scenes
1478 srcTaskItem.NextPermissions; 1555 srcTaskItem.NextPermissions;
1479 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1556 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1480 srcTaskItem.NextPermissions; 1557 srcTaskItem.NextPermissions;
1481 destTaskItem.CurrentPermissions |= 8; // Slam! 1558 destTaskItem.CurrentPermissions |= 16; // Slam!
1482 } 1559 }
1483 } 1560 }
1484 1561
@@ -1864,17 +1941,14 @@ namespace OpenSim.Region.Framework.Scenes
1864 1941
1865 group.SetGroup(sourcePart.GroupID, null); 1942 group.SetGroup(sourcePart.GroupID, null);
1866 1943
1867 if (rootPart.OwnerID != item.OwnerID) 1944 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
1868 { 1945 {
1869 if (Permissions.PropagatePermissions()) 1946 if (Permissions.PropagatePermissions())
1870 { 1947 {
1871 if ((item.CurrentPermissions & 8) != 0) 1948 foreach (SceneObjectPart part in partList)
1872 { 1949 {
1873 foreach (SceneObjectPart part in partList) 1950 part.EveryoneMask = item.EveryonePermissions;
1874 { 1951 part.NextOwnerMask = item.NextPermissions;
1875 part.EveryoneMask = item.EveryonePermissions;
1876 part.NextOwnerMask = item.NextPermissions;
1877 }
1878 } 1952 }
1879 group.ApplyNextOwnerPermissions(); 1953 group.ApplyNextOwnerPermissions();
1880 } 1954 }
@@ -1882,17 +1956,14 @@ namespace OpenSim.Region.Framework.Scenes
1882 1956
1883 foreach (SceneObjectPart part in partList) 1957 foreach (SceneObjectPart part in partList)
1884 { 1958 {
1885 if (part.OwnerID != item.OwnerID) 1959 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
1886 { 1960 {
1887 part.LastOwnerID = part.OwnerID; 1961 part.LastOwnerID = part.OwnerID;
1888 part.OwnerID = item.OwnerID; 1962 part.OwnerID = item.OwnerID;
1889 part.Inventory.ChangeInventoryOwner(item.OwnerID); 1963 part.Inventory.ChangeInventoryOwner(item.OwnerID);
1890 } 1964 }
1891 else if ((item.CurrentPermissions & 8) != 0) // Slam! 1965 part.EveryoneMask = item.EveryonePermissions;
1892 { 1966 part.NextOwnerMask = item.NextPermissions;
1893 part.EveryoneMask = item.EveryonePermissions;
1894 part.NextOwnerMask = item.NextPermissions;
1895 }
1896 } 1967 }
1897 1968
1898 rootPart.TrimPermissions(); 1969 rootPart.TrimPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e2ab643..40176ec 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -478,8 +478,6 @@ namespace OpenSim.Region.Framework.Scenes
478 set { m_sceneGraph.RestorePresences = value; } 478 set { m_sceneGraph.RestorePresences = value; }
479 } 479 }
480 480
481 public int objectCapacity = 45000;
482
483 #endregion 481 #endregion
484 482
485 #region BinaryStats 483 #region BinaryStats
@@ -687,7 +685,7 @@ namespace OpenSim.Region.Framework.Scenes
687 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 685 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
688 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 686 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
689 687
690 StatsReporter.SetObjectCapacity(objectCapacity); 688 StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity);
691 689
692 // Old 690 // Old
693 /* 691 /*
@@ -4119,20 +4117,6 @@ namespace OpenSim.Region.Framework.Scenes
4119 4117
4120 #region Other Methods 4118 #region Other Methods
4121 4119
4122 public void SetObjectCapacity(int objects)
4123 {
4124 // Region specific config overrides global
4125 //
4126 if (RegionInfo.ObjectCapacity != 0)
4127 objects = RegionInfo.ObjectCapacity;
4128
4129 if (StatsReporter != null)
4130 {
4131 StatsReporter.SetObjectCapacity(objects);
4132 }
4133 objectCapacity = objects;
4134 }
4135
4136 #endregion 4120 #endregion
4137 4121
4138 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) 4122 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
@@ -4731,7 +4715,7 @@ namespace OpenSim.Region.Framework.Scenes
4731 part.NextOwnerMask; 4715 part.NextOwnerMask;
4732 item.GroupPermissions = part.GroupMask & 4716 item.GroupPermissions = part.GroupMask &
4733 part.NextOwnerMask; 4717 part.NextOwnerMask;
4734 item.CurrentPermissions |= 8; // Slam! 4718 item.CurrentPermissions |= 16; // Slam!
4735 item.CreationDate = Util.UnixTimeSinceEpoch(); 4719 item.CreationDate = Util.UnixTimeSinceEpoch();
4736 4720
4737 if (InventoryService.AddItem(item)) 4721 if (InventoryService.AddItem(item))
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index f7e46af..9a01a28 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -172,13 +172,14 @@ namespace OpenSim.Region.Framework.Scenes
172 taskItem.GroupPermissions = item.GroupPermissions & 172 taskItem.GroupPermissions = item.GroupPermissions &
173 item.NextPermissions; 173 item.NextPermissions;
174 taskItem.NextPermissions = item.NextPermissions; 174 taskItem.NextPermissions = item.NextPermissions;
175 taskItem.CurrentPermissions |= 8; 175 // We're adding this to a prim we don't own. Force
176 // owner change
177 taskItem.CurrentPermissions |= 16; // Slam
176 } 178 }
177 else 179 else
178 { 180 {
179 taskItem.BasePermissions = item.BasePermissions; 181 taskItem.BasePermissions = item.BasePermissions;
180 taskItem.CurrentPermissions = item.CurrentPermissions; 182 taskItem.CurrentPermissions = item.CurrentPermissions;
181 taskItem.CurrentPermissions |= 8;
182 taskItem.EveryonePermissions = item.EveryOnePermissions; 183 taskItem.EveryonePermissions = item.EveryOnePermissions;
183 taskItem.GroupPermissions = item.GroupPermissions; 184 taskItem.GroupPermissions = item.GroupPermissions;
184 taskItem.NextPermissions = item.NextPermissions; 185 taskItem.NextPermissions = item.NextPermissions;
@@ -281,7 +282,7 @@ namespace OpenSim.Region.Framework.Scenes
281 PermissionMask.Move | 282 PermissionMask.Move |
282 PermissionMask.Transfer) | 7; 283 PermissionMask.Transfer) | 7;
283 284
284 uint ownerMask = 0x7ffffff; 285 uint ownerMask = 0x7fffffff;
285 foreach (SceneObjectPart part in m_parts.Values) 286 foreach (SceneObjectPart part in m_parts.Values)
286 { 287 {
287 ownerMask &= part.OwnerMask; 288 ownerMask &= part.OwnerMask;
@@ -295,12 +296,16 @@ namespace OpenSim.Region.Framework.Scenes
295 if ((ownerMask & (uint)PermissionMask.Transfer) == 0) 296 if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
296 perms &= ~(uint)PermissionMask.Transfer; 297 perms &= ~(uint)PermissionMask.Transfer;
297 298
298 if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0) 299 // If root prim permissions are applied here, this would screw
299 perms &= ~((uint)PermissionMask.Modify >> 13); 300 // with in-inventory manipulation of the next owner perms
300 if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0) 301 // in a major way. So, let's move this to the give itself.
301 perms &= ~((uint)PermissionMask.Copy >> 13); 302 // Yes. I know. Evil.
302 if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) 303// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
303 perms &= ~((uint)PermissionMask.Transfer >> 13); 304// perms &= ~((uint)PermissionMask.Modify >> 13);
305// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
306// perms &= ~((uint)PermissionMask.Copy >> 13);
307// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
308// perms &= ~((uint)PermissionMask.Transfer >> 13);
304 309
305 return perms; 310 return perms;
306 } 311 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3a8f168..cabcf37 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -952,7 +952,6 @@ namespace OpenSim.Region.Framework.Scenes
952 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; 952 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
953 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) 953 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
954 item.CurrentPermissions &= ~(uint)PermissionMask.Modify; 954 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
955 item.CurrentPermissions |= 8;
956 } 955 }
957 item.CurrentPermissions &= item.NextPermissions; 956 item.CurrentPermissions &= item.NextPermissions;
958 item.BasePermissions &= item.NextPermissions; 957 item.BasePermissions &= item.NextPermissions;
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index 6f5ef9e..653f856 100644
--- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
+++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
@@ -138,8 +138,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
138 public void AddRegion(Scene scene) 138 public void AddRegion(Scene scene)
139 { 139 {
140 // Send ObjectCapacity to Scene.. Which sends it to the SimStatsReporter. 140 // Send ObjectCapacity to Scene.. Which sends it to the SimStatsReporter.
141 scene.SetObjectCapacity(ObjectCapacity);
142
143 if (m_enabled) 141 if (m_enabled)
144 { 142 {
145 scene.RegisterModuleInterface<IMoneyModule>(this); 143 scene.RegisterModuleInterface<IMoneyModule>(this);
@@ -252,7 +250,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
252 250
253 if (config == "Economy" && startupConfig != null) 251 if (config == "Economy" && startupConfig != null)
254 { 252 {
255 ObjectCapacity = startupConfig.GetInt("ObjectCapacity", 45000);
256 PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100); 253 PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100);
257 PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10); 254 PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10);
258 PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4); 255 PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4);
@@ -701,7 +698,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
701 698
702 if (user != null) 699 if (user != null)
703 { 700 {
704 user.SendEconomyData(EnergyEfficiency, ObjectCapacity, ObjectCount, PriceEnergyUnit, PriceGroupCreate, 701 Scene s = LocateSceneClientIn(user.AgentId);
702
703 user.SendEconomyData(EnergyEfficiency, s.RegionInfo.ObjectCapacity, ObjectCount, PriceEnergyUnit, PriceGroupCreate,
705 PriceObjectClaim, PriceObjectRent, PriceObjectScaleFactor, PriceParcelClaim, PriceParcelClaimFactor, 704 PriceObjectClaim, PriceObjectRent, PriceObjectScaleFactor, PriceParcelClaim, PriceParcelClaimFactor,
706 PriceParcelRent, PricePublicObjectDecay, PricePublicObjectDelete, PriceRentLight, PriceUpload, 705 PriceParcelRent, PricePublicObjectDecay, PricePublicObjectDelete, PriceRentLight, PriceUpload,
707 TeleportMinPrice, TeleportPriceExponent); 706 TeleportMinPrice, TeleportPriceExponent);