diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 1533462..4652d70 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -32,7 +32,7 @@ using log4net; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications.Cache; | 35 | |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
@@ -95,6 +95,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
95 | 95 | ||
96 | protected Scene m_scene; | 96 | protected Scene m_scene; |
97 | 97 | ||
98 | private InventoryFolderImpl m_libraryRootFolder; | ||
99 | protected InventoryFolderImpl LibraryRootFolder | ||
100 | { | ||
101 | get | ||
102 | { | ||
103 | if (m_libraryRootFolder != null) | ||
104 | return m_libraryRootFolder; | ||
105 | |||
106 | ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>(); | ||
107 | if (lib != null) | ||
108 | { | ||
109 | m_libraryRootFolder = lib.LibraryRootFolder; | ||
110 | } | ||
111 | return m_libraryRootFolder; | ||
112 | } | ||
113 | } | ||
114 | |||
98 | #region Constants | 115 | #region Constants |
99 | // These are here for testing. They will be taken out | 116 | // These are here for testing. They will be taken out |
100 | 117 | ||
@@ -462,12 +479,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
462 | { | 479 | { |
463 | if (user == UUID.Zero) return false; | 480 | if (user == UUID.Zero) return false; |
464 | 481 | ||
465 | if (m_scene.RegionInfo.MasterAvatarAssignedUUID != UUID.Zero) | ||
466 | { | ||
467 | if (m_RegionOwnerIsGod && (m_scene.RegionInfo.MasterAvatarAssignedUUID == user)) | ||
468 | return true; | ||
469 | } | ||
470 | |||
471 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | 482 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) |
472 | { | 483 | { |
473 | if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod) | 484 | if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod) |
@@ -479,10 +490,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
479 | 490 | ||
480 | if (m_allowGridGods) | 491 | if (m_allowGridGods) |
481 | { | 492 | { |
482 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | 493 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); |
483 | if (profile != null && profile.UserProfile != null) | 494 | if (account != null) |
484 | { | 495 | { |
485 | if (profile.UserProfile.GodLevel >= 200) | 496 | if (account.UserLevel >= 200) |
486 | return true; | 497 | return true; |
487 | } | 498 | } |
488 | } | 499 | } |
@@ -499,13 +510,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
499 | if (m_friendsModule == null) | 510 | if (m_friendsModule == null) |
500 | return false; | 511 | return false; |
501 | 512 | ||
502 | List<FriendListItem> profile = m_friendsModule.GetUserFriends(user); | 513 | uint friendPerms = m_friendsModule.GetFriendPerms(user, objectOwner); |
514 | if ((friendPerms & (uint)FriendRights.CanModifyObjects) != 0) | ||
515 | return true; | ||
503 | 516 | ||
504 | foreach (FriendListItem item in profile) | ||
505 | { | ||
506 | if (item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0) | ||
507 | return true; | ||
508 | } | ||
509 | return false; | 517 | return false; |
510 | } | 518 | } |
511 | 519 | ||
@@ -1011,9 +1019,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1011 | IInventoryService invService = m_scene.InventoryService; | 1019 | IInventoryService invService = m_scene.InventoryService; |
1012 | InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); | 1020 | InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); |
1013 | assetRequestItem = invService.GetItem(assetRequestItem); | 1021 | assetRequestItem = invService.GetItem(assetRequestItem); |
1014 | if (assetRequestItem == null) // Library item | 1022 | if (assetRequestItem == null && LibraryRootFolder != null) // Library item |
1015 | { | 1023 | { |
1016 | assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); | 1024 | assetRequestItem = LibraryRootFolder.FindItem(notecard); |
1017 | 1025 | ||
1018 | if (assetRequestItem != null) // Implicitly readable | 1026 | if (assetRequestItem != null) // Implicitly readable |
1019 | return true; | 1027 | return true; |
@@ -1431,9 +1439,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1431 | IInventoryService invService = m_scene.InventoryService; | 1439 | IInventoryService invService = m_scene.InventoryService; |
1432 | InventoryItemBase assetRequestItem = new InventoryItemBase(script, user); | 1440 | InventoryItemBase assetRequestItem = new InventoryItemBase(script, user); |
1433 | assetRequestItem = invService.GetItem(assetRequestItem); | 1441 | assetRequestItem = invService.GetItem(assetRequestItem); |
1434 | if (assetRequestItem == null) // Library item | 1442 | if (assetRequestItem == null && LibraryRootFolder != null) // Library item |
1435 | { | 1443 | { |
1436 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); | 1444 | assetRequestItem = LibraryRootFolder.FindItem(script); |
1437 | 1445 | ||
1438 | if (assetRequestItem != null) // Implicitly readable | 1446 | if (assetRequestItem != null) // Implicitly readable |
1439 | return true; | 1447 | return true; |
@@ -1526,9 +1534,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1526 | IInventoryService invService = m_scene.InventoryService; | 1534 | IInventoryService invService = m_scene.InventoryService; |
1527 | InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); | 1535 | InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); |
1528 | assetRequestItem = invService.GetItem(assetRequestItem); | 1536 | assetRequestItem = invService.GetItem(assetRequestItem); |
1529 | if (assetRequestItem == null) // Library item | 1537 | if (assetRequestItem == null && LibraryRootFolder != null) // Library item |
1530 | { | 1538 | { |
1531 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); | 1539 | assetRequestItem = LibraryRootFolder.FindItem(notecard); |
1532 | 1540 | ||
1533 | if (assetRequestItem != null) // Implicitly readable | 1541 | if (assetRequestItem != null) // Implicitly readable |
1534 | return true; | 1542 | return true; |