diff options
author | KittoFlora | 2009-11-15 22:20:51 +0100 |
---|---|---|
committer | KittoFlora | 2009-11-15 22:20:51 +0100 |
commit | ba77f0c2ac9e41d7c8ca00ddf4b68bc4f25deaee (patch) | |
tree | e218f290178d98e63aa8ab6aef46c1715195c32e /OpenSim/Region/CoreModules/World/Permissions | |
parent | Merge branch 'master' into vehicles (diff) | |
parent | Make GroupRootUpdate be a terse update. This method is not used by opensim (i... (diff) | |
download | opensim-SC-ba77f0c2ac9e41d7c8ca00ddf4b68bc4f25deaee.zip opensim-SC-ba77f0c2ac9e41d7c8ca00ddf4b68bc4f25deaee.tar.gz opensim-SC-ba77f0c2ac9e41d7c8ca00ddf4b68bc4f25deaee.tar.bz2 opensim-SC-ba77f0c2ac9e41d7c8ca00ddf4b68bc4f25deaee.tar.xz |
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Permissions')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index fe9de1b..c790624 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -144,6 +144,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
144 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); | 144 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); |
145 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); | 145 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); |
146 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); | 146 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); |
147 | private IFriendsModule m_friendsModule = null; | ||
148 | |||
147 | #endregion | 149 | #endregion |
148 | 150 | ||
149 | #region IRegionModule Members | 151 | #region IRegionModule Members |
@@ -363,6 +365,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
363 | 365 | ||
364 | public void PostInitialise() | 366 | public void PostInitialise() |
365 | { | 367 | { |
368 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
369 | |||
370 | if (m_friendsModule == null) | ||
371 | m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); | ||
372 | else | ||
373 | m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); | ||
366 | } | 374 | } |
367 | 375 | ||
368 | public void Close() | 376 | public void Close() |
@@ -476,6 +484,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
476 | 484 | ||
477 | return false; | 485 | return false; |
478 | } | 486 | } |
487 | protected bool IsFriendWithPerms(UUID user,UUID objectOwner) | ||
488 | { | ||
489 | |||
490 | if (user == UUID.Zero) | ||
491 | return false; | ||
492 | |||
493 | if (m_friendsModule == null) | ||
494 | return false; | ||
495 | |||
496 | List<FriendListItem> profile = m_friendsModule.GetUserFriends(user); | ||
497 | |||
498 | foreach (FriendListItem item in profile) | ||
499 | { | ||
500 | if(item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0) | ||
501 | return true; | ||
502 | } | ||
503 | return false; | ||
504 | } | ||
479 | 505 | ||
480 | protected bool IsEstateManager(UUID user) | 506 | protected bool IsEstateManager(UUID user) |
481 | { | 507 | { |
@@ -565,6 +591,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
565 | // Object owners should be able to edit their own content | 591 | // Object owners should be able to edit their own content |
566 | if (user == objectOwner) | 592 | if (user == objectOwner) |
567 | return objectOwnerMask; | 593 | return objectOwnerMask; |
594 | |||
595 | if (IsFriendWithPerms(user, objectOwner)) | ||
596 | return objectOwnerMask; | ||
568 | 597 | ||
569 | // Estate users should be able to edit anything in the sim | 598 | // Estate users should be able to edit anything in the sim |
570 | if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner)) | 599 | if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner)) |