aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorUbitUmarov2017-01-20 13:45:44 +0000
committerUbitUmarov2017-01-20 13:45:44 +0000
commitdf40cdc83e5aca49ccca5e527bc43daf9b194c0c (patch)
treeffc61d39acebef9f47b5eb79b0600b1442c75f5f /OpenSim/Region/CoreModules/World
parentchange CanDuplicateObject (diff)
downloadopensim-SC-df40cdc83e5aca49ccca5e527bc43daf9b194c0c.zip
opensim-SC-df40cdc83e5aca49ccca5e527bc43daf9b194c0c.tar.gz
opensim-SC-df40cdc83e5aca49ccca5e527bc43daf9b194c0c.tar.bz2
opensim-SC-df40cdc83e5aca49ccca5e527bc43daf9b194c0c.tar.xz
remove redundant IsGod, rename some GOD as Administrator (both only on permissions module)
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs170
1 files changed, 59 insertions, 111 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 341bd7e..79308b4 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
91 private bool m_bypassPermissionsValue = true; 91 private bool m_bypassPermissionsValue = true;
92 private bool m_propagatePermissions = false; 92 private bool m_propagatePermissions = false;
93 private bool m_debugPermissions = false; 93 private bool m_debugPermissions = false;
94 private bool m_allowGridGods = false; 94 private bool m_allowGridAdmins = false;
95 private bool m_RegionOwnerIsGod = false; 95 private bool m_RegionOwnerIsAdmin = false;
96 private bool m_RegionManagerIsGod = false; 96 private bool m_RegionManagerIsAdmin = false;
97 private bool m_forceGridGodsOnly; 97 private bool m_forceGridAdminsOnly;
98 private bool m_forceGodModeAlwaysOn; 98 private bool m_forceAdminModeAlwaysOn;
99 private bool m_allowGodActionsWithoutGodMode; 99 private bool m_allowAdminActionsWithoutGodMode;
100 100
101 private bool m_SimpleBuildPermissions = false; 101 private bool m_SimpleBuildPermissions = false;
102 102
@@ -167,23 +167,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
167 167
168 string[] sections = new string[] { "Startup", "Permissions" }; 168 string[] sections = new string[] { "Startup", "Permissions" };
169 169
170 m_allowGridGods = Util.GetConfigVarFromSections<bool>(config, "allow_grid_gods", sections, false); 170 m_allowGridAdmins = Util.GetConfigVarFromSections<bool>(config, "allow_grid_gods", sections, false);
171 m_bypassPermissions = !Util.GetConfigVarFromSections<bool>(config, "serverside_object_permissions", sections, true); 171 m_bypassPermissions = !Util.GetConfigVarFromSections<bool>(config, "serverside_object_permissions", sections, true);
172 m_propagatePermissions = Util.GetConfigVarFromSections<bool>(config, "propagate_permissions", sections, true); 172 m_propagatePermissions = Util.GetConfigVarFromSections<bool>(config, "propagate_permissions", sections, true);
173 173
174 m_forceGridGodsOnly = Util.GetConfigVarFromSections<bool>(config, "force_grid_gods_only", sections, false); 174 m_forceGridAdminsOnly = Util.GetConfigVarFromSections<bool>(config, "force_grid_gods_only", sections, false);
175 if(!m_forceGridGodsOnly) 175 if(!m_forceGridAdminsOnly)
176 { 176 {
177 m_RegionOwnerIsGod = Util.GetConfigVarFromSections<bool>(config, "region_owner_is_god",sections, true); 177 m_RegionOwnerIsAdmin = Util.GetConfigVarFromSections<bool>(config, "region_owner_is_god",sections, true);
178 m_RegionManagerIsGod = Util.GetConfigVarFromSections<bool>(config, "region_manager_is_god",sections, false); 178 m_RegionManagerIsAdmin = Util.GetConfigVarFromSections<bool>(config, "region_manager_is_god",sections, false);
179 } 179 }
180 else 180 else
181 m_allowGridGods = true; 181 m_allowGridAdmins = true;
182 182
183 m_forceGodModeAlwaysOn = Util.GetConfigVarFromSections<bool>(config, "automatic_gods", sections, false); 183 m_forceAdminModeAlwaysOn = Util.GetConfigVarFromSections<bool>(config, "automatic_gods", sections, false);
184 m_allowGodActionsWithoutGodMode = Util.GetConfigVarFromSections<bool>(config, "implicit_gods", sections, false); 184 m_allowAdminActionsWithoutGodMode = Util.GetConfigVarFromSections<bool>(config, "implicit_gods", sections, false);
185 if(m_allowGodActionsWithoutGodMode) 185 if(m_allowAdminActionsWithoutGodMode)
186 m_forceGodModeAlwaysOn = false; 186 m_forceAdminModeAlwaysOn = false;
187 187
188 m_SimpleBuildPermissions = Util.GetConfigVarFromSections<bool>(config, "simple_build_permissions",sections, false); 188 m_SimpleBuildPermissions = Util.GetConfigVarFromSections<bool>(config, "simple_build_permissions",sections, false);
189 189
@@ -271,8 +271,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
271 m_scene.Permissions.OnReclaimParcel += CanReclaimParcel; 271 m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
272 m_scene.Permissions.OnDeedParcel += CanDeedParcel; 272 m_scene.Permissions.OnDeedParcel += CanDeedParcel;
273 m_scene.Permissions.OnDeedObject += CanDeedObject; 273 m_scene.Permissions.OnDeedObject += CanDeedObject;
274 m_scene.Permissions.OnIsGod += IsGod; 274 m_scene.Permissions.OnIsGridGod += IsGridAdministrator;
275 m_scene.Permissions.OnIsGridGod += IsGridGod;
276 m_scene.Permissions.OnIsAdministrator += IsAdministrator; 275 m_scene.Permissions.OnIsAdministrator += IsAdministrator;
277 m_scene.Permissions.OnIsEstateManager += IsEstateManager; 276 m_scene.Permissions.OnIsEstateManager += IsEstateManager;
278 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 277 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
@@ -552,13 +551,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
552 if (user == UUID.Zero) 551 if (user == UUID.Zero)
553 return false; 552 return false;
554 553
555 if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod) 554 if (m_RegionOwnerIsAdmin && m_scene.RegionInfo.EstateSettings.EstateOwner == user)
556 return true; 555 return true;
557 556
558 if (IsEstateManager(user) && m_RegionManagerIsGod) 557 if (m_RegionManagerIsAdmin && IsEstateManager(user))
559 return true; 558 return true;
560 559
561 if (IsGridGod(user, null)) 560 if (IsGridAdministrator(user))
562 return true; 561 return true;
563 562
564 return false; 563 return false;
@@ -570,14 +569,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
570 /// <param name="user">The user</param> 569 /// <param name="user">The user</param>
571 /// <param name="scene">Unused, can be null</param> 570 /// <param name="scene">Unused, can be null</param>
572 /// <returns></returns> 571 /// <returns></returns>
573 protected bool IsGridGod(UUID user, Scene scene) 572 protected bool IsGridAdministrator(UUID user)
574 { 573 {
575 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 574 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
576 if (m_bypassPermissions) return m_bypassPermissionsValue; 575 if (m_bypassPermissions) return m_bypassPermissionsValue;
577 576
578 if (user == UUID.Zero) return false; 577 if (user == UUID.Zero)
578 return false;
579 579
580 if (m_allowGridGods) 580 if (m_allowGridAdmins)
581 { 581 {
582 ScenePresence sp = m_scene.GetScenePresence(user); 582 ScenePresence sp = m_scene.GetScenePresence(user);
583 if (sp != null) 583 if (sp != null)
@@ -631,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
631 } 631 }
632 632
633 #region Object Permissions 633 #region Object Permissions
634#pragma warning disable 0612 634
635 const uint DEFAULT_FLAGS = (uint)( 635 const uint DEFAULT_FLAGS = (uint)(
636 PrimFlags.ObjectCopy | // Tells client you can copy the object 636 PrimFlags.ObjectCopy | // Tells client you can copy the object
637 PrimFlags.ObjectModify | // tells client you can modify the object 637 PrimFlags.ObjectModify | // tells client you can modify the object
@@ -651,7 +651,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
651 PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object 651 PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
652 PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object 652 PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
653 ); 653 );
654#pragma warning restore 0612
655 654
656 const uint EXTRAOWNERMASK = (uint)( 655 const uint EXTRAOWNERMASK = (uint)(
657 PrimFlags.ObjectYouOwner | 656 PrimFlags.ObjectYouOwner |
@@ -693,7 +692,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
693 692
694 uint returnMask; 693 uint returnMask;
695 694
696
697 SceneObjectGroup grp = task.ParentGroup; 695 SceneObjectGroup grp = task.ParentGroup;
698 if(grp == null) 696 if(grp == null)
699 return 0; 697 return 0;
@@ -1059,85 +1057,54 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1059 1057
1060 public bool GenericEstatePermission(UUID user) 1058 public bool GenericEstatePermission(UUID user)
1061 { 1059 {
1062 // Default: deny
1063 bool permission = false;
1064
1065 // Estate admins should be able to use estate tools 1060 // Estate admins should be able to use estate tools
1066 if (IsEstateManager(user)) 1061 if (IsEstateManager(user))
1067 permission = true; 1062 return true;
1068 1063
1069 // Administrators always have permission 1064 // Administrators always have permission
1070 if (IsAdministrator(user)) 1065 if (IsAdministrator(user))
1071 permission = true; 1066 return true;
1072 1067
1073 return permission; 1068 return false;
1074 } 1069 }
1075 1070
1076 protected bool GenericParcelPermission(UUID user, ILandObject parcel, ulong groupPowers) 1071 protected bool GenericParcelPermission(UUID user, ILandObject parcel, ulong groupPowers)
1077 { 1072 {
1078 bool permission = false;
1079
1080 if (parcel.LandData.OwnerID == user) 1073 if (parcel.LandData.OwnerID == user)
1081 { 1074 return true;
1082 permission = true;
1083 }
1084 1075
1085 if ((parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, user, groupPowers)) 1076 if ((parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
1086 { 1077 return true;
1087 permission = true;
1088 }
1089 1078
1090 if (IsEstateManager(user)) 1079 if (IsEstateManager(user))
1091 { 1080 return true;
1092 permission = true;
1093 }
1094 1081
1095 if (IsAdministrator(user)) 1082 if (IsAdministrator(user))
1096 { 1083 return true;
1097 permission = true;
1098 }
1099 1084
1100 if (m_SimpleBuildPermissions && 1085 if (m_SimpleBuildPermissions &&
1101 (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user)) 1086 (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
1102 permission = true; 1087 return true;
1103 1088
1104 return permission; 1089 return false;
1105 } 1090 }
1106 1091
1107 protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers, bool allowEstateManager) 1092 protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers, bool allowEstateManager)
1108 { 1093 {
1109 if (parcel.LandData.OwnerID == user) 1094 if (parcel.LandData.OwnerID == user)
1110 {
1111 // Returning immediately so that group deeded objects on group deeded land don't trigger a NRE on
1112 // the subsequent redundant checks when using lParcelMediaCommandList()
1113 // See http://opensimulator.org/mantis/view.php?id=3999 for more details
1114 return true; 1095 return true;
1115 }
1116 1096
1117 if (parcel.LandData.IsGroupOwned && IsGroupMember(parcel.LandData.GroupID, user, groupPowers)) 1097 if (parcel.LandData.IsGroupOwned && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
1118 {
1119 return true; 1098 return true;
1120 }
1121 1099
1122 if (allowEstateManager && IsEstateManager(user)) 1100 if (allowEstateManager && IsEstateManager(user))
1123 {
1124 return true; 1101 return true;
1125 }
1126 1102
1127 if (IsAdministrator(user)) 1103 if (IsAdministrator(user))
1128 {
1129 return true; 1104 return true;
1130 }
1131 1105
1132 return false; 1106 return false;
1133 } 1107 }
1134
1135 protected bool GenericParcelPermission(UUID user, Vector3 pos, ulong groupPowers)
1136 {
1137 ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
1138 if (parcel == null) return false;
1139 return GenericParcelPermission(user, parcel, groupPowers);
1140 }
1141#endregion 1108#endregion
1142 1109
1143 #region Permission Checks 1110 #region Permission Checks
@@ -1165,6 +1132,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1165 if (parcel.LandData.OwnerID != user) // Only the owner can deed! 1132 if (parcel.LandData.OwnerID != user) // Only the owner can deed!
1166 return false; 1133 return false;
1167 1134
1135 if(parcel.LandData.GroupID == UUID.Zero)
1136 return false;
1137
1168 ScenePresence sp = scene.GetScenePresence(user); 1138 ScenePresence sp = scene.GetScenePresence(user);
1169 IClientAPI client = sp.ControllingClient; 1139 IClientAPI client = sp.ControllingClient;
1170 1140
@@ -1213,14 +1183,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1213 return true; 1183 return true;
1214 } 1184 }
1215 1185
1216 private bool IsGod(UUID user, Scene scene)
1217 {
1218 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1219 if (m_bypassPermissions) return m_bypassPermissionsValue;
1220
1221 return IsAdministrator(user);
1222 }
1223
1224 private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene) 1186 private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene)
1225 { 1187 {
1226 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1188 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1480,53 +1442,39 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1480 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1442 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1481 if (m_bypassPermissions) return m_bypassPermissionsValue; 1443 if (m_bypassPermissions) return m_bypassPermissionsValue;
1482 1444
1483 // allow outide region?? 1445 // allow outide region this mb needed for crossings ???
1484 if (newPoint.X < -1f || newPoint.Y < -1f) 1446 if (newPoint.X < -1f || newPoint.Y < -1f)
1485 return true; 1447 return true;
1486 if (newPoint.X > scene.RegionInfo.RegionSizeX + 1.0f || newPoint.Y > scene.RegionInfo.RegionSizeY + 1.0f) 1448 if (newPoint.X > scene.RegionInfo.RegionSizeX + 1.0f || newPoint.Y > scene.RegionInfo.RegionSizeY + 1.0f)
1487 {
1488 return true; 1449 return true;
1489 }
1490
1491 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
1492
1493 ILandObject land = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
1494 1450
1495 if (!enteringRegion) 1451 ILandObject parcel = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
1496 { 1452 if (parcel == null)
1497 ILandObject fromland = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
1498
1499 if (fromland == land) // Not entering
1500 return true;
1501 }
1502
1503 if (land == null)
1504 {
1505 return false; 1453 return false;
1506 }
1507 1454
1508 if ((land.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0) 1455 if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0)
1509 {
1510 return true; 1456 return true;
1511 }
1512 1457
1513 if (!m_scene.Entities.ContainsKey(objectID)) 1458 EntityBase ent = null;
1514 { 1459 if (!m_scene.Entities.TryGetValue(objectID, out ent))
1515 return false; 1460 return false;
1516 }
1517 1461
1518 // If it's not an object, we cant edit it. 1462 if(ent == null || !(ent is SceneObjectGroup))
1519 if (!(m_scene.Entities[objectID] is SceneObjectGroup))
1520 {
1521 return false; 1463 return false;
1522 }
1523 1464
1465 SceneObjectGroup task = (SceneObjectGroup)ent;
1524 1466
1525 if (GenericParcelPermission(task.OwnerID, newPoint, 0)) 1467 if (!enteringRegion)
1526 { 1468 {
1527 return true; 1469 ILandObject fromparcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
1470
1471 if (fromparcel == parcel) // it already entered parcel ????
1472 return true;
1528 } 1473 }
1529 1474
1475 if (GenericParcelPermission(task.OwnerID, parcel, 0))
1476 return true;
1477
1530 //Otherwise, false! 1478 //Otherwise, false!
1531 return false; 1479 return false;
1532 } 1480 }
@@ -1632,7 +1580,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1632 return true; 1580 return true;
1633 } 1581 }
1634 1582
1635 private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) 1583 private bool CanRezObject(int objectCount, UUID userID, Vector3 objectPosition, Scene scene)
1636 { 1584 {
1637 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1585 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1638 if (m_bypassPermissions) 1586 if (m_bypassPermissions)
@@ -1640,26 +1588,26 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1640 1588
1641// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name); 1589// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name);
1642 1590
1643 ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 1591 ILandObject parcel = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
1644 if (parcel == null || parcel.LandData == null) 1592 if (parcel == null || parcel.LandData == null)
1645 return false; 1593 return false;
1646 1594
1647 LandData landdata = parcel.LandData; 1595 LandData landdata = parcel.LandData;
1648 if ((owner == landdata.OwnerID)) 1596 if ((userID == landdata.OwnerID))
1649 return true; 1597 return true;
1650 1598
1651 if ((landdata.Flags & (uint)ParcelFlags.CreateObjects) != 0) 1599 if ((landdata.Flags & (uint)ParcelFlags.CreateObjects) != 0)
1652 return true; 1600 return true;
1653 1601
1654 if(IsAdministrator(owner)) 1602 if(IsAdministrator(userID))
1655 return true; 1603 return true;
1656 1604
1657 if(landdata.GroupID != UUID.Zero) 1605 if(landdata.GroupID != UUID.Zero)
1658 { 1606 {
1659 if ((landdata.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0) 1607 if ((landdata.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0)
1660 return IsGroupMember(landdata.GroupID, owner, 0); 1608 return IsGroupMember(landdata.GroupID, userID, 0);
1661 1609
1662 if (landdata.IsGroupOwned && IsGroupMember(landdata.GroupID, owner, (ulong)GroupPowers.AllowRez)) 1610 if (landdata.IsGroupOwned && IsGroupMember(landdata.GroupID, userID, (ulong)GroupPowers.AllowRez))
1663 return true; 1611 return true;
1664 } 1612 }
1665 1613