aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-23 03:36:16 +0000
committerMelanie Thielker2008-09-23 03:36:16 +0000
commit70d264ee6cfae6cfe90d38460c4087b9956dab6c (patch)
tree2261f8969fb30b7d88bf2cb72fe5ec0ba435bcef /OpenSim/Region/Environment/Modules/World
parent* Update in OGP draft 3 protocol spec with regards to seed region requests ru... (diff)
downloadopensim-SC-70d264ee6cfae6cfe90d38460c4087b9956dab6c.zip
opensim-SC-70d264ee6cfae6cfe90d38460c4087b9956dab6c.tar.gz
opensim-SC-70d264ee6cfae6cfe90d38460c4087b9956dab6c.tar.bz2
opensim-SC-70d264ee6cfae6cfe90d38460c4087b9956dab6c.tar.xz
Update the permissions system to handle scripts and notecards the way
it was meant to. No functional changes, just better code
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs66
1 files changed, 65 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index ff5ba18..fbdae85 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -631,7 +631,10 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
631 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 631 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
632 if (m_bypassPermissions) return m_bypassPermissionsValue; 632 if (m_bypassPermissions) return m_bypassPermissionsValue;
633 633
634 return false; 634 // If you can view it, you can edit it
635 // There is no viewing a no mod script
636 //
637 return CanViewScript(script, objectID, user, scene);
635 } 638 }
636 639
637 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 640 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
@@ -639,6 +642,67 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
639 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 642 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
640 if (m_bypassPermissions) return m_bypassPermissionsValue; 643 if (m_bypassPermissions) return m_bypassPermissionsValue;
641 644
645 if (objectID == UUID.Zero) // User inventory
646 {
647 CachedUserInfo userInfo =
648 scene.CommsManager.UserProfileCacheService.GetUserDetails(user);
649 if (userInfo == null)
650 return false;
651
652 if (userInfo.RootFolder == null)
653 return false;
654
655 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard);
656 if (assetRequestItem == null) // Library item
657 {
658 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
659
660 if (assetRequestItem != null) // Implicitly readable
661 return true;
662 }
663
664 // Notecards must be both mod and copy to be saveable
665 // This is because of they're not copy, you can't read
666 // them, and if they're not mod, well, then they're
667 // not mod. Duh.
668 //
669 if ((assetRequestItem.CurrentPermissions &
670 ((uint)PermissionMask.Modify |
671 (uint)PermissionMask.Copy)) !=
672 ((uint)PermissionMask.Modify |
673 (uint)PermissionMask.Copy))
674 return false;
675 }
676 else // Prim inventory
677 {
678 SceneObjectPart part = scene.GetSceneObjectPart(objectID);
679
680 if (part == null)
681 return false;
682
683 if (part.OwnerID != user)
684 return false;
685
686 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
687 return false;
688
689 TaskInventoryItem ti = part.GetInventoryItem(notecard);
690
691 if (ti == null)
692 return false;
693
694 if (ti.OwnerID != user)
695 return false;
696
697 // Require full perms
698 if ((ti.CurrentPermissions &
699 ((uint)PermissionMask.Modify |
700 (uint)PermissionMask.Copy)) !=
701 ((uint)PermissionMask.Modify |
702 (uint)PermissionMask.Copy))
703 return false;
704 }
705
642 return true; 706 return true;
643 } 707 }
644 708