aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs21
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs87
3 files changed, 95 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 9d84e66..2b5cb31 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -1649,8 +1649,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1649 { 1649 {
1650 foreach (SceneObjectGroup obj in primsOverMe) 1650 foreach (SceneObjectGroup obj in primsOverMe)
1651 { 1651 {
1652 if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero && 1652 if(m_scene.Permissions.CanSellObject(previousOwner,obj, (byte)SaleType.Original))
1653 (obj.EffectiveOwnerPerms & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0)
1654 m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0); 1653 m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
1655 } 1654 }
1656 } 1655 }
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 142c8b7..90d65c7 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -89,28 +89,23 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
89 if (part == null) 89 if (part == null)
90 return; 90 return;
91 91
92 if (part.ParentGroup.IsDeleted) 92 SceneObjectGroup sog = part.ParentGroup;
93 if (sog == null || sog.IsDeleted)
93 return; 94 return;
94 95
95 if (part.OwnerID != part.GroupID && part.OwnerID != client.AgentId && (!m_scene.Permissions.IsGod(client.AgentId))) 96 // Does the user have the power to put the object on sale?
96 return; 97 if (!m_scene.Permissions.CanSellObject(client, sog, saleType))
97
98 if (part.OwnerID == part.GroupID) // Group owned
99 { 98 {
100 // Does the user have the power to put the object on sale? 99 client.SendAgentAlertMessage("You don't have permission to set object on sale", false);
101 if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID)) 100 return;
102 {
103 client.SendAgentAlertMessage("You don't have permission to set group-owned objects on sale", false);
104 return;
105 }
106 } 101 }
107 102
108 part = part.ParentGroup.RootPart; 103 part = sog.RootPart;
109 104
110 part.ObjectSaleType = saleType; 105 part.ObjectSaleType = saleType;
111 part.SalePrice = salePrice; 106 part.SalePrice = salePrice;
112 107
113 part.ParentGroup.HasGroupChanged = true; 108 sog.HasGroupChanged = true;
114 109
115 part.SendPropertiesToClient(client); 110 part.SendPropertiesToClient(client);
116 } 111 }
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 279b966..7f2b29a 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -300,6 +300,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
300 scenePermissions.OnDelinkObject += CanDelinkObject; 300 scenePermissions.OnDelinkObject += CanDelinkObject;
301 scenePermissions.OnDeedObject += CanDeedObject; 301 scenePermissions.OnDeedObject += CanDeedObject;
302 scenePermissions.OnSellGroupObject += CanSellGroupObject; 302 scenePermissions.OnSellGroupObject += CanSellGroupObject;
303 scenePermissions.OnSellObjectByUserID += CanSellObjectByUserID;
304 scenePermissions.OnSellObject += CanSellObject;
303 305
304 scenePermissions.OnCreateObjectInventory += CanCreateObjectInventory; 306 scenePermissions.OnCreateObjectInventory += CanCreateObjectInventory;
305 scenePermissions.OnEditObjectInventory += CanEditObjectInventory; 307 scenePermissions.OnEditObjectInventory += CanEditObjectInventory;
@@ -393,7 +395,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
393 scenePermissions.OnLinkObject -= CanLinkObject; 395 scenePermissions.OnLinkObject -= CanLinkObject;
394 scenePermissions.OnDelinkObject -= CanDelinkObject; 396 scenePermissions.OnDelinkObject -= CanDelinkObject;
395 scenePermissions.OnDeedObject -= CanDeedObject; 397 scenePermissions.OnDeedObject -= CanDeedObject;
398
396 scenePermissions.OnSellGroupObject -= CanSellGroupObject; 399 scenePermissions.OnSellGroupObject -= CanSellGroupObject;
400 scenePermissions.OnSellObjectByUserID -= CanSellObjectByUserID;
401 scenePermissions.OnSellObject -= CanSellObject;
397 402
398 scenePermissions.OnCreateObjectInventory -= CanCreateObjectInventory; 403 scenePermissions.OnCreateObjectInventory -= CanCreateObjectInventory;
399 scenePermissions.OnEditObjectInventory -= CanEditObjectInventory; 404 scenePermissions.OnEditObjectInventory -= CanEditObjectInventory;
@@ -1826,6 +1831,86 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1826 return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale); 1831 return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale);
1827 } 1832 }
1828 1833
1834 private bool CanSellObjectByUserID(SceneObjectGroup sog, UUID userID, byte saleType)
1835 {
1836 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1837 if (m_bypassPermissions) return m_bypassPermissionsValue;
1838
1839 if (sog == null || sog.IsDeleted || userID == UUID.Zero)
1840 return false;
1841
1842 // sell is not a attachment op
1843 if(sog.IsAttachment)
1844 return false;
1845
1846 if(IsAdministrator(userID))
1847 return true;
1848
1849 uint sogEffectiveOwnerPerms = sog.EffectiveOwnerPerms;
1850 if((sogEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
1851 return false;
1852
1853 if(saleType == (byte)SaleType.Copy &&
1854 (sogEffectiveOwnerPerms & (uint)PermissionMask.Copy) == 0)
1855 return false;
1856
1857 UUID sogOwnerID = sog.OwnerID;
1858
1859 if(sogOwnerID == userID)
1860 return true;
1861
1862 // else only group owned can be sold by members with powers
1863 UUID sogGroupID = sog.GroupID;
1864 if(sog.OwnerID != sogGroupID || sogGroupID == UUID.Zero)
1865 return false;
1866
1867 return IsGroupMember(sogGroupID, userID, (ulong)GroupPowers.ObjectSetForSale);
1868 }
1869
1870 private bool CanSellObject(SceneObjectGroup sog, ScenePresence sp, byte saleType)
1871 {
1872 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1873 if (m_bypassPermissions) return m_bypassPermissionsValue;
1874
1875 if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
1876 return false;
1877
1878 // sell is not a attachment op
1879 if(sog.IsAttachment)
1880 return false;
1881
1882 if(sp.IsGod)
1883 return true;
1884
1885 uint sogEffectiveOwnerPerms = sog.EffectiveOwnerPerms;
1886 if((sogEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
1887 return false;
1888
1889 if(saleType == (byte)SaleType.Copy &&
1890 (sogEffectiveOwnerPerms & (uint)PermissionMask.Copy) == 0)
1891 return false;
1892
1893 UUID userID = sp.UUID;
1894 UUID sogOwnerID = sog.OwnerID;
1895
1896 if(sogOwnerID == userID)
1897 return true;
1898
1899 // else only group owned can be sold by members with powers
1900 UUID sogGroupID = sog.GroupID;
1901 if(sog.OwnerID != sogGroupID || sogGroupID == UUID.Zero)
1902 return false;
1903
1904 ulong powers = 0;
1905 if(!GroupMemberPowers(sogGroupID, sp, ref powers))
1906 return false;
1907
1908 if((powers & (ulong)GroupPowers.ObjectSetForSale) == 0)
1909 return false;
1910
1911 return true;
1912 }
1913
1829 private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp) 1914 private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
1830 { 1915 {
1831 // ignore locked, viewers shell ask for confirmation 1916 // ignore locked, viewers shell ask for confirmation
@@ -1835,7 +1920,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1835 if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted) 1920 if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
1836 return false; 1921 return false;
1837 1922
1838 // take is not a attachment op 1923 // take is not a attachment op
1839 if(sog.IsAttachment) 1924 if(sog.IsAttachment)
1840 return false; 1925 return false;
1841 1926