aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs89
1 files changed, 46 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f360577..9622555 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
103 //private uint PERM_MODIFY = (uint)16384; 103 //private uint PERM_MODIFY = (uint)16384;
104 private uint PERM_MOVE = (uint)524288; 104 private uint PERM_MOVE = (uint)524288;
105 private uint PERM_TRANS = (uint)8192; 105 private uint PERM_TRANS = (uint)8192;
106 private uint PERM_LOCKED = (uint)540672; 106 private uint PERM_LOCKED = (uint)540672;
107 107
108 /// <value> 108 /// <value>
109 /// Different user set names that come in from the configuration file. 109 /// Different user set names that come in from the configuration file.
@@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
114 Administrators 114 Administrators
115 }; 115 };
116 116
117 #endregion 117 #endregion
118 118
119 #region Bypass Permissions / Debug Permissions Stuff 119 #region Bypass Permissions / Debug Permissions Stuff
120 120
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
136 /// <value> 136 /// <value>
137 /// The set of users that are allowed to edit (save) scripts. This is only active if 137 /// The set of users that are allowed to edit (save) scripts. This is only active if
138 /// permissions are not being bypassed. This overrides normal permissions.- 138 /// permissions are not being bypassed. This overrides normal permissions.-
139 /// </value> 139 /// </value>
140 private UserSet m_allowedScriptEditors = UserSet.All; 140 private UserSet m_allowedScriptEditors = UserSet.All;
141 141
142 private Dictionary<string, bool> GrantLSL = new Dictionary<string, bool>(); 142 private Dictionary<string, bool> GrantLSL = new Dictionary<string, bool>();
@@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
190 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 190 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
191 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 191 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
192 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED 192 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
193 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED 193 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED
194 m_scene.Permissions.OnInstantMessage += CanInstantMessage; 194 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
195 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED 195 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED
196 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED 196 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -210,12 +210,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
210 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED 210 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED
211 211
212 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED 212 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED
213 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED 213 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED
214 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED 214 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED
215 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED 215 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED
216 216
217 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE 217 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE
218 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 218 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
219 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED 219 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED
220 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED 220 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED
221 m_scene.Permissions.OnResetScript += CanResetScript; 221 m_scene.Permissions.OnResetScript += CanResetScript;
@@ -249,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
249 foreach (string uuidl in grant.Split(',')) { 249 foreach (string uuidl in grant.Split(',')) {
250 string uuid = uuidl.Trim(" \t".ToCharArray()); 250 string uuid = uuidl.Trim(" \t".ToCharArray());
251 GrantLSL.Add(uuid, true); 251 GrantLSL.Add(uuid, true);
252 } 252 }
253 } 253 }
254 254
255 grant = myConfig.GetString("GrantCS",""); 255 grant = myConfig.GetString("GrantCS","");
@@ -431,7 +431,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
431 m_log.ErrorFormat( 431 m_log.ErrorFormat(
432 "[PERMISSIONS]: {0} is not a valid {1} value, setting to {2}", 432 "[PERMISSIONS]: {0} is not a valid {1} value, setting to {2}",
433 rawSetting, settingName, userSet); 433 rawSetting, settingName, userSet);
434 } 434 }
435 435
436 m_log.DebugFormat("[PERMISSIONS]: {0} {1}", settingName, userSet); 436 m_log.DebugFormat("[PERMISSIONS]: {0} {1}", settingName, userSet);
437 437
@@ -569,16 +569,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
569 569
570 // Users should be able to edit what is over their land. 570 // Users should be able to edit what is over their land.
571 ILandObject parcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); 571 ILandObject parcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
572 if (parcel != null && parcel.landData.OwnerID == user && m_ParcelOwnerIsGod) 572 if (parcel != null && parcel.LandData.OwnerID == user && m_ParcelOwnerIsGod)
573 { 573 {
574 // Admin objects should not be editable by the above 574 // Admin objects should not be editable by the above
575 if (!IsAdministrator(objectOwner)) 575 if (!IsAdministrator(objectOwner))
576 return objectOwnerMask; 576 return objectOwnerMask;
577 } 577 }
578 578
579 if ((objectOwnerMask & (uint)PermissionMask.Transfer) != 0 && task.ObjectSaleType != 0)
580 objectEveryoneMask |= (uint)PrimFlags.ObjectTransfer;
581
579 // Group permissions 582 // Group permissions
580 if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0)) 583 if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0))
581 return objectGroupMask; 584 return objectGroupMask | objectEveryoneMask;
582 585
583 return objectEveryoneMask; 586 return objectEveryoneMask;
584 } 587 }
@@ -672,7 +675,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
672 675
673 // Users should be able to edit what is over their land. 676 // Users should be able to edit what is over their land.
674 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); 677 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
675 if ((parcel != null) && (parcel.landData.OwnerID == currentUser)) 678 if ((parcel != null) && (parcel.LandData.OwnerID == currentUser))
676 { 679 {
677 permission = true; 680 permission = true;
678 } 681 }
@@ -740,12 +743,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
740 { 743 {
741 bool permission = false; 744 bool permission = false;
742 745
743 if (parcel.landData.OwnerID == user) 746 if (parcel.LandData.OwnerID == user)
744 { 747 {
745 permission = true; 748 permission = true;
746 } 749 }
747 750
748 if ((parcel.landData.GroupID != UUID.Zero) && IsGroupMember(parcel.landData.GroupID, user, groupPowers)) 751 if ((parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
749 { 752 {
750 permission = true; 753 permission = true;
751 } 754 }
@@ -767,12 +770,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
767 { 770 {
768 bool permission = false; 771 bool permission = false;
769 772
770 if (parcel.landData.OwnerID == user) 773 if (parcel.LandData.OwnerID == user)
771 { 774 {
772 permission = true; 775 permission = true;
773 } 776 }
774 777
775 if (parcel.landData.IsGroupOwned && IsGroupMember(parcel.landData.GroupID, user, groupPowers)) 778 if (parcel.LandData.IsGroupOwned && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
776 { 779 {
777 permission = true; 780 permission = true;
778 } 781 }
@@ -820,13 +823,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
820 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 823 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
821 if (m_bypassPermissions) return m_bypassPermissionsValue; 824 if (m_bypassPermissions) return m_bypassPermissionsValue;
822 825
823 if (parcel.landData.OwnerID != user) // Only the owner can deed! 826 if (parcel.LandData.OwnerID != user) // Only the owner can deed!
824 return false; 827 return false;
825 828
826 ScenePresence sp = scene.GetScenePresence(user); 829 ScenePresence sp = scene.GetScenePresence(user);
827 IClientAPI client = sp.ControllingClient; 830 IClientAPI client = sp.ControllingClient;
828 831
829 if ((client.GetGroupPowers(parcel.landData.GroupID) & (ulong)GroupPowers.LandDeed) == 0) 832 if ((client.GetGroupPowers(parcel.LandData.GroupID) & (ulong)GroupPowers.LandDeed) == 0)
830 return false; 833 return false;
831 834
832 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed); 835 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed);
@@ -942,7 +945,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
942 if (m_bypassPermissions) return m_bypassPermissionsValue; 945 if (m_bypassPermissions) return m_bypassPermissionsValue;
943 946
944 if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user)) 947 if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user))
945 return false; 948 return false;
946 949
947 // Ordinarily, if you can view it, you can edit it 950 // Ordinarily, if you can view it, you can edit it
948 // There is no viewing a no mod script 951 // There is no viewing a no mod script
@@ -957,7 +960,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
957 /// <param name="objectID"></param> 960 /// <param name="objectID"></param>
958 /// <param name="user"></param> 961 /// <param name="user"></param>
959 /// <param name="scene"></param> 962 /// <param name="scene"></param>
960 /// <returns></returns> 963 /// <returns></returns>
961 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 964 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
962 { 965 {
963 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 966 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1189,7 +1192,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1189 return false; 1192 return false;
1190 } 1193 }
1191 1194
1192 if ((land.landData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0) 1195 if ((land.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0)
1193 { 1196 {
1194 return true; 1197 return true;
1195 } 1198 }
@@ -1233,7 +1236,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1233 ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 1236 ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
1234 if (land == null) return false; 1237 if (land == null) return false;
1235 1238
1236 if ((land.landData.Flags & ((int)ParcelFlags.CreateObjects)) == 1239 if ((land.LandData.Flags & ((int)ParcelFlags.CreateObjects)) ==
1237 (int)ParcelFlags.CreateObjects) 1240 (int)ParcelFlags.CreateObjects)
1238 permission = true; 1241 permission = true;
1239 1242
@@ -1360,7 +1363,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1360 return false; 1363 return false;
1361 1364
1362 // Others allowed to terraform? 1365 // Others allowed to terraform?
1363 if ((parcel.landData.Flags & ((int)ParcelFlags.AllowTerraform)) != 0) 1366 if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowTerraform)) != 0)
1364 return true; 1367 return true;
1365 1368
1366 // Land owner can terraform too 1369 // Land owner can terraform too
@@ -1377,11 +1380,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1377 /// <param name="objectID"></param> 1380 /// <param name="objectID"></param>
1378 /// <param name="user"></param> 1381 /// <param name="user"></param>
1379 /// <param name="scene"></param> 1382 /// <param name="scene"></param>
1380 /// <returns></returns> 1383 /// <returns></returns>
1381 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene) 1384 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene)
1382 { 1385 {
1383 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1386 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1384 if (m_bypassPermissions) return m_bypassPermissionsValue; 1387 if (m_bypassPermissions) return m_bypassPermissionsValue;
1385 1388
1386 if (objectID == UUID.Zero) // User inventory 1389 if (objectID == UUID.Zero) // User inventory
1387 { 1390 {
@@ -1472,7 +1475,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1472 /// <param name="objectID"></param> 1475 /// <param name="objectID"></param>
1473 /// <param name="user"></param> 1476 /// <param name="user"></param>
1474 /// <param name="scene"></param> 1477 /// <param name="scene"></param>
1475 /// <returns></returns> 1478 /// <returns></returns>
1476 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 1479 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
1477 { 1480 {
1478 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1481 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1609,7 +1612,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1609 /// </summary> 1612 /// </summary>
1610 /// <param name="invType"></param> 1613 /// <param name="invType"></param>
1611 /// <param name="userID"></param> 1614 /// <param name="userID"></param>
1612 /// <returns></returns> 1615 /// <returns></returns>
1613 private bool CanCreateUserInventory(int invType, UUID userID) 1616 private bool CanCreateUserInventory(int invType, UUID userID)
1614 { 1617 {
1615 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1618 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1619,7 +1622,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1619 if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID)) 1622 if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID))
1620 return false; 1623 return false;
1621 1624
1622 return true; 1625 return true;
1623 } 1626 }
1624 1627
1625 /// <summary> 1628 /// <summary>
@@ -1627,27 +1630,27 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1627 /// </summary> 1630 /// </summary>
1628 /// <param name="itemID"></param> 1631 /// <param name="itemID"></param>
1629 /// <param name="userID"></param> 1632 /// <param name="userID"></param>
1630 /// <returns></returns> 1633 /// <returns></returns>
1631 private bool CanCopyUserInventory(UUID itemID, UUID userID) 1634 private bool CanCopyUserInventory(UUID itemID, UUID userID)
1632 { 1635 {
1633 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1636 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1634 if (m_bypassPermissions) return m_bypassPermissionsValue; 1637 if (m_bypassPermissions) return m_bypassPermissionsValue;
1635 1638
1636 return true; 1639 return true;
1637 } 1640 }
1638 1641
1639 /// <summary> 1642 /// <summary>
1640 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. 1643 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
1641 /// </summary> 1644 /// </summary>
1642 /// <param name="itemID"></param> 1645 /// <param name="itemID"></param>
1643 /// <param name="userID"></param> 1646 /// <param name="userID"></param>
1644 /// <returns></returns> 1647 /// <returns></returns>
1645 private bool CanEditUserInventory(UUID itemID, UUID userID) 1648 private bool CanEditUserInventory(UUID itemID, UUID userID)
1646 { 1649 {
1647 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1650 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1648 if (m_bypassPermissions) return m_bypassPermissionsValue; 1651 if (m_bypassPermissions) return m_bypassPermissionsValue;
1649 1652
1650 return true; 1653 return true;
1651 } 1654 }
1652 1655
1653 /// <summary> 1656 /// <summary>
@@ -1655,14 +1658,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1655 /// </summary> 1658 /// </summary>
1656 /// <param name="itemID"></param> 1659 /// <param name="itemID"></param>
1657 /// <param name="userID"></param> 1660 /// <param name="userID"></param>
1658 /// <returns></returns> 1661 /// <returns></returns>
1659 private bool CanDeleteUserInventory(UUID itemID, UUID userID) 1662 private bool CanDeleteUserInventory(UUID itemID, UUID userID)
1660 { 1663 {
1661 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1664 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1662 if (m_bypassPermissions) return m_bypassPermissionsValue; 1665 if (m_bypassPermissions) return m_bypassPermissionsValue;
1663 1666
1664 return true; 1667 return true;
1665 } 1668 }
1666 1669
1667 private bool CanTeleport(UUID userID, Scene scene) 1670 private bool CanTeleport(UUID userID, Scene scene)
1668 { 1671 {
@@ -1693,27 +1696,27 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1693 if (m_bypassPermissions) return m_bypassPermissionsValue; 1696 if (m_bypassPermissions) return m_bypassPermissionsValue;
1694 1697
1695 long powers = 0; 1698 long powers = 0;
1696 if (parcel.landData.GroupID != UUID.Zero) 1699 if (parcel.LandData.GroupID != UUID.Zero)
1697 client.GetGroupPowers(parcel.landData.GroupID); 1700 client.GetGroupPowers(parcel.LandData.GroupID);
1698 1701
1699 switch (type) 1702 switch (type)
1700 { 1703 {
1701 case (uint)ObjectReturnType.Owner: 1704 case (uint)ObjectReturnType.Owner:
1702 // Don't let group members return owner's objects, ever 1705 // Don't let group members return owner's objects, ever
1703 // 1706 //
1704 if (parcel.landData.IsGroupOwned) 1707 if (parcel.LandData.IsGroupOwned)
1705 { 1708 {
1706 if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0) 1709 if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0)
1707 return true; 1710 return true;
1708 } 1711 }
1709 else 1712 else
1710 { 1713 {
1711 if (parcel.landData.OwnerID != client.AgentId) 1714 if (parcel.LandData.OwnerID != client.AgentId)
1712 return false; 1715 return false;
1713 } 1716 }
1714 return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned); 1717 return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned);
1715 case (uint)ObjectReturnType.Group: 1718 case (uint)ObjectReturnType.Group:
1716 if (parcel.landData.OwnerID != client.AgentId) 1719 if (parcel.LandData.OwnerID != client.AgentId)
1717 { 1720 {
1718 // If permissionis granted through a group... 1721 // If permissionis granted through a group...
1719 // 1722 //