aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Permissions
diff options
context:
space:
mode:
authorUbitUmarov2017-03-30 17:39:21 +0100
committerUbitUmarov2017-03-30 17:39:21 +0100
commit9a01fddd1cefea0508b6b1616771e6ef8eabef87 (patch)
tree2e98a32008bb69965b9be3ef417b56cb60a49e25 /OpenSim/Region/CoreModules/World/Permissions
parentmantis 8131: make the new Offline IM code optional and disabled by default, s... (diff)
downloadopensim-SC-9a01fddd1cefea0508b6b1616771e6ef8eabef87.zip
opensim-SC-9a01fddd1cefea0508b6b1616771e6ef8eabef87.tar.gz
opensim-SC-9a01fddd1cefea0508b6b1616771e6ef8eabef87.tar.bz2
opensim-SC-9a01fddd1cefea0508b6b1616771e6ef8eabef87.tar.xz
add CanSellObject() permitions check functions
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Permissions')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs87
1 files changed, 86 insertions, 1 deletions
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