diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 98 |
1 files changed, 47 insertions, 51 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f3afac7..890d07a 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -69,10 +69,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
69 | } | 69 | } |
70 | 70 | ||
71 | #region Constants | 71 | #region Constants |
72 | // These are here for testing. They will be taken out | ||
73 | |||
74 | private uint PERM_LOCKED = (uint)524288; // same as move | ||
75 | |||
76 | /// <value> | 72 | /// <value> |
77 | /// Different user set names that come in from the configuration file. | 73 | /// Different user set names that come in from the configuration file. |
78 | /// </value> | 74 | /// </value> |
@@ -866,7 +862,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
866 | return 0; | 862 | return 0; |
867 | 863 | ||
868 | UUID objectOwner = group.OwnerID; | 864 | UUID objectOwner = group.OwnerID; |
869 | bool locked = denyOnLocked && ((root.OwnerMask & PERM_LOCKED) == 0); | 865 | bool locked = denyOnLocked && ((root.OwnerMask & (uint)PermissionMask.Move) == 0); |
870 | 866 | ||
871 | if (IsAdministrator(currentUser)) | 867 | if (IsAdministrator(currentUser)) |
872 | { | 868 | { |
@@ -920,7 +916,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
920 | UUID spID = sp.UUID; | 916 | UUID spID = sp.UUID; |
921 | UUID objectOwner = group.OwnerID; | 917 | UUID objectOwner = group.OwnerID; |
922 | 918 | ||
923 | bool locked = denyOnLocked && ((root.OwnerMask & PERM_LOCKED) == 0); | 919 | bool locked = denyOnLocked && ((root.OwnerMask & (uint)PermissionMask.Move) == 0); |
924 | 920 | ||
925 | if (sp.IsGod) | 921 | if (sp.IsGod) |
926 | { | 922 | { |
@@ -960,12 +956,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
960 | return group.EffectiveEveryOnePerms & lockmask; | 956 | return group.EffectiveEveryOnePerms & lockmask; |
961 | } | 957 | } |
962 | 958 | ||
963 | private uint GetObjectItemPermissions(UUID userID, TaskInventoryItem ti, bool notEveryone) | 959 | private uint GetObjectItemPermissions(UUID userID, TaskInventoryItem ti) |
964 | { | 960 | { |
965 | UUID tiOwnerID = ti.OwnerID; | 961 | UUID tiOwnerID = ti.OwnerID; |
966 | if(tiOwnerID == userID) | 962 | if(tiOwnerID == userID) |
967 | return ti.CurrentPermissions; | 963 | return ti.CurrentPermissions; |
968 | 964 | ||
965 | if(IsAdministrator(userID)) | ||
966 | return (uint)PermissionMask.AllEffective; | ||
969 | // ?? | 967 | // ?? |
970 | if (IsFriendWithPerms(userID, tiOwnerID)) | 968 | if (IsFriendWithPerms(userID, tiOwnerID)) |
971 | return ti.CurrentPermissions; | 969 | return ti.CurrentPermissions; |
@@ -981,17 +979,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
981 | if((powers & (ulong)GroupPowers.ObjectManipulate) != 0) | 979 | if((powers & (ulong)GroupPowers.ObjectManipulate) != 0) |
982 | return ti.CurrentPermissions; | 980 | return ti.CurrentPermissions; |
983 | } | 981 | } |
984 | uint p = ti.GroupPermissions; | 982 | return ti.GroupPermissions; |
985 | if(!notEveryone) | ||
986 | p |= ti.EveryonePermissions; | ||
987 | return p; | ||
988 | } | 983 | } |
989 | } | 984 | } |
990 | 985 | ||
991 | if(notEveryone) | 986 | return 0; |
992 | return 0; | ||
993 | |||
994 | return ti.EveryonePermissions; | ||
995 | } | 987 | } |
996 | 988 | ||
997 | private uint GetObjectItemPermissions(ScenePresence sp, TaskInventoryItem ti, bool notEveryone) | 989 | private uint GetObjectItemPermissions(ScenePresence sp, TaskInventoryItem ti, bool notEveryone) |
@@ -1104,19 +1096,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1104 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1096 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1105 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1097 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1106 | 1098 | ||
1107 | if (parcel.LandData.OwnerID != user) // Only the owner can deed! | 1099 | if(parcel.LandData.GroupID == UUID.Zero) |
1108 | return false; | 1100 | return false; |
1109 | 1101 | ||
1110 | if(parcel.LandData.GroupID == UUID.Zero) | 1102 | if (IsAdministrator(user)) |
1103 | return true; | ||
1104 | |||
1105 | if (parcel.LandData.OwnerID != user) // Only the owner can deed! | ||
1111 | return false; | 1106 | return false; |
1112 | 1107 | ||
1113 | ScenePresence sp = scene.GetScenePresence(user); | 1108 | ScenePresence sp = scene.GetScenePresence(user); |
1114 | IClientAPI client = sp.ControllingClient; | 1109 | if(sp == null) |
1110 | return false; | ||
1115 | 1111 | ||
1112 | IClientAPI client = sp.ControllingClient; | ||
1116 | if ((client.GetGroupPowers(parcel.LandData.GroupID) & (ulong)GroupPowers.LandDeed) == 0) | 1113 | if ((client.GetGroupPowers(parcel.LandData.GroupID) & (ulong)GroupPowers.LandDeed) == 0) |
1117 | return false; | 1114 | return false; |
1118 | 1115 | ||
1119 | return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed, false); | 1116 | return true; |
1120 | } | 1117 | } |
1121 | 1118 | ||
1122 | private bool CanDeedObject(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID) | 1119 | private bool CanDeedObject(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID) |
@@ -1383,13 +1380,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1383 | if (IsAdministrator(user)) | 1380 | if (IsAdministrator(user)) |
1384 | return true; | 1381 | return true; |
1385 | 1382 | ||
1386 | if (m_scene.RegionInfo.EstateSettings.IsEstateOwner(user)) | ||
1387 | return true; | ||
1388 | |||
1389 | if (ownerCommand) | 1383 | if (ownerCommand) |
1390 | return false; | 1384 | return m_scene.RegionInfo.EstateSettings.IsEstateOwner(user); |
1391 | 1385 | ||
1392 | return GenericEstatePermission(user); | 1386 | return IsEstateManager(user); |
1393 | } | 1387 | } |
1394 | 1388 | ||
1395 | private bool CanMoveObject(SceneObjectGroup sog, ScenePresence sp) | 1389 | private bool CanMoveObject(SceneObjectGroup sog, ScenePresence sp) |
@@ -1764,7 +1758,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1764 | /// <param name="user"></param> | 1758 | /// <param name="user"></param> |
1765 | /// <param name="scene"></param> | 1759 | /// <param name="scene"></param> |
1766 | /// <returns></returns> | 1760 | /// <returns></returns> |
1767 | private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene) | 1761 | private bool CanViewScript(UUID script, UUID objectID, UUID userID, Scene scene) |
1768 | { | 1762 | { |
1769 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1763 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1770 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1764 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
@@ -1772,7 +1766,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1772 | if (objectID == UUID.Zero) // User inventory | 1766 | if (objectID == UUID.Zero) // User inventory |
1773 | { | 1767 | { |
1774 | IInventoryService invService = m_scene.InventoryService; | 1768 | IInventoryService invService = m_scene.InventoryService; |
1775 | InventoryItemBase assetRequestItem = invService.GetItem(user, script); | 1769 | InventoryItemBase assetRequestItem = invService.GetItem(userID, script); |
1776 | if (assetRequestItem == null && LibraryRootFolder != null) // Library item | 1770 | if (assetRequestItem == null && LibraryRootFolder != null) // Library item |
1777 | { | 1771 | { |
1778 | assetRequestItem = LibraryRootFolder.FindItem(script); | 1772 | assetRequestItem = LibraryRootFolder.FindItem(script); |
@@ -1792,12 +1786,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1792 | // readable only if it's really full perms | 1786 | // readable only if it's really full perms |
1793 | // | 1787 | // |
1794 | if ((assetRequestItem.CurrentPermissions & | 1788 | if ((assetRequestItem.CurrentPermissions & |
1789 | /* | ||
1795 | ((uint)PermissionMask.Modify | | 1790 | ((uint)PermissionMask.Modify | |
1796 | (uint)PermissionMask.Copy | | 1791 | (uint)PermissionMask.Copy | |
1797 | (uint)PermissionMask.Transfer)) != | 1792 | (uint)PermissionMask.Transfer)) != |
1798 | ((uint)PermissionMask.Modify | | 1793 | ((uint)PermissionMask.Modify | |
1799 | (uint)PermissionMask.Copy | | 1794 | (uint)PermissionMask.Copy | |
1800 | (uint)PermissionMask.Transfer)) | 1795 | (uint)PermissionMask.Transfer)) |
1796 | */ | ||
1797 | (uint)(PermissionMask.Modify | PermissionMask.Copy)) != | ||
1798 | (uint)(PermissionMask.Modify | PermissionMask.Copy)) | ||
1801 | return false; | 1799 | return false; |
1802 | } | 1800 | } |
1803 | else // Prim inventory | 1801 | else // Prim inventory |
@@ -1810,7 +1808,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1810 | if (sog == null) | 1808 | if (sog == null) |
1811 | return false; | 1809 | return false; |
1812 | 1810 | ||
1813 | uint perms = GetObjectPermissions(user, sog, true); | 1811 | uint perms = GetObjectPermissions(userID, sog, true); |
1814 | if((perms & (uint)PermissionMask.Modify) == 0) | 1812 | if((perms & (uint)PermissionMask.Modify) == 0) |
1815 | return false; | 1813 | return false; |
1816 | 1814 | ||
@@ -1820,23 +1818,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1820 | if (ti == null) // legacy may not have type | 1818 | if (ti == null) // legacy may not have type |
1821 | return false; | 1819 | return false; |
1822 | 1820 | ||
1823 | if (ti.OwnerID != user) | 1821 | uint itperms = GetObjectItemPermissions(userID, ti); |
1824 | { | ||
1825 | if (ti.GroupID == UUID.Zero) | ||
1826 | return false; | ||
1827 | |||
1828 | if (!IsGroupMember(ti.GroupID, user, 0)) | ||
1829 | return false; | ||
1830 | } | ||
1831 | 1822 | ||
1832 | // Require full perms | 1823 | // Require full perms |
1833 | if ((ti.CurrentPermissions & | 1824 | |
1834 | ((uint)PermissionMask.Modify | | 1825 | if ((itperms & |
1826 | /* | ||
1827 | ((uint)(PermissionMask.Modify | | ||
1835 | (uint)PermissionMask.Copy | | 1828 | (uint)PermissionMask.Copy | |
1836 | (uint)PermissionMask.Transfer)) != | 1829 | (uint)PermissionMask.Transfer)) != |
1837 | ((uint)PermissionMask.Modify | | 1830 | ((uint)PermissionMask.Modify | |
1838 | (uint)PermissionMask.Copy | | 1831 | (uint)PermissionMask.Copy | |
1839 | (uint)PermissionMask.Transfer)) | 1832 | (uint)PermissionMask.Transfer)) |
1833 | */ | ||
1834 | (uint)(PermissionMask.Modify | PermissionMask.Copy)) != | ||
1835 | (uint)(PermissionMask.Modify | PermissionMask.Copy)) | ||
1840 | return false; | 1836 | return false; |
1841 | } | 1837 | } |
1842 | 1838 | ||
@@ -1851,7 +1847,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1851 | /// <param name="user"></param> | 1847 | /// <param name="user"></param> |
1852 | /// <param name="scene"></param> | 1848 | /// <param name="scene"></param> |
1853 | /// <returns></returns> | 1849 | /// <returns></returns> |
1854 | private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) | 1850 | private bool CanViewNotecard(UUID notecard, UUID objectID, UUID userID, Scene scene) |
1855 | { | 1851 | { |
1856 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1852 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1857 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1853 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
@@ -1859,7 +1855,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1859 | if (objectID == UUID.Zero) // User inventory | 1855 | if (objectID == UUID.Zero) // User inventory |
1860 | { | 1856 | { |
1861 | IInventoryService invService = m_scene.InventoryService; | 1857 | IInventoryService invService = m_scene.InventoryService; |
1862 | InventoryItemBase assetRequestItem = invService.GetItem(user, notecard); | 1858 | InventoryItemBase assetRequestItem = invService.GetItem(userID, notecard); |
1863 | if (assetRequestItem == null && LibraryRootFolder != null) // Library item | 1859 | if (assetRequestItem == null && LibraryRootFolder != null) // Library item |
1864 | { | 1860 | { |
1865 | assetRequestItem = LibraryRootFolder.FindItem(notecard); | 1861 | assetRequestItem = LibraryRootFolder.FindItem(notecard); |
@@ -1885,7 +1881,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1885 | if (sog == null) | 1881 | if (sog == null) |
1886 | return false; | 1882 | return false; |
1887 | 1883 | ||
1888 | uint perms = GetObjectPermissions(user, sog, true); | 1884 | uint perms = GetObjectPermissions(userID, sog, true); |
1889 | if((perms & (uint)PermissionMask.Modify) == 0) | 1885 | if((perms & (uint)PermissionMask.Modify) == 0) |
1890 | return false; | 1886 | return false; |
1891 | 1887 | ||
@@ -1895,18 +1891,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1895 | if (ti == null) | 1891 | if (ti == null) |
1896 | return false; | 1892 | return false; |
1897 | 1893 | ||
1898 | if (ti.OwnerID != user) | 1894 | uint itperms = GetObjectItemPermissions(userID, ti); |
1899 | { | ||
1900 | if (ti.GroupID == UUID.Zero) | ||
1901 | return false; | ||
1902 | |||
1903 | if (!IsGroupMember(ti.GroupID, user, 0)) | ||
1904 | return false; | ||
1905 | } | ||
1906 | 1895 | ||
1907 | // Notecards are always readable unless no copy | 1896 | // Notecards are always readable unless no copy |
1908 | // | 1897 | // |
1909 | if ((ti.CurrentPermissions & | 1898 | if ((itperms & |
1910 | (uint)PermissionMask.Copy) != | 1899 | (uint)PermissionMask.Copy) != |
1911 | (uint)PermissionMask.Copy) | 1900 | (uint)PermissionMask.Copy) |
1912 | return false; | 1901 | return false; |
@@ -1976,7 +1965,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1976 | if(ti == null) | 1965 | if(ti == null) |
1977 | return false; | 1966 | return false; |
1978 | 1967 | ||
1979 | //TODO item perm ? | 1968 | uint itperms = GetObjectItemPermissions(userID, ti); |
1969 | |||
1970 | if((itperms & (uint)PermissionMask.Copy) == 0) | ||
1971 | return false; | ||
1972 | |||
1973 | if(sog.OwnerID != userID && (itperms & (uint)PermissionMask.Transfer) == 0) | ||
1974 | return false; | ||
1975 | |||
1980 | return true; | 1976 | return true; |
1981 | } | 1977 | } |
1982 | 1978 | ||