aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs13
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs26
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs9
-rw-r--r--OpenSim/Region/Environment/Interfaces/IScenePermissions.cs103
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs (renamed from OpenSim/Region/Environment/PermissionManager.cs)66
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs42
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs34
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs6
17 files changed, 217 insertions, 122 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 43f7375..a25f3c0 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -74,7 +74,6 @@ namespace OpenSim
74 protected List<RegionInfo> m_regionData = new List<RegionInfo>(); 74 protected List<RegionInfo> m_regionData = new List<RegionInfo>();
75 75
76 protected bool m_physicalPrim; 76 protected bool m_physicalPrim;
77 protected bool m_permissions = false;
78 77
79 protected bool m_standaloneAuthenticate = false; 78 protected bool m_standaloneAuthenticate = false;
80 protected string m_standaloneWelcomeMessage = null; 79 protected string m_standaloneWelcomeMessage = null;
@@ -263,9 +262,7 @@ namespace OpenSim
263 m_physicalPrim = startupConfig.GetBoolean("physical_prim", true); 262 m_physicalPrim = startupConfig.GetBoolean("physical_prim", true);
264 263
265 m_see_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor", true); 264 m_see_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor", true);
266 265
267 m_permissions = startupConfig.GetBoolean("serverside_object_permissions", false);
268
269 m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.Data.SQLite.dll"); 266 m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.Data.SQLite.dll");
270 if (m_storageDll == "OpenSim.DataStore.MonoSqlite.dll") 267 if (m_storageDll == "OpenSim.DataStore.MonoSqlite.dll")
271 { 268 {
@@ -490,7 +487,7 @@ namespace OpenSim
490 } 487 }
491 488
492 IClientNetworkServer clientServer; 489 IClientNetworkServer clientServer;
493 Scene scene = SetupScene(regionInfo, proxyOffset, out clientServer, m_permissions); 490 Scene scene = SetupScene(regionInfo, proxyOffset, out clientServer);
494 491
495 m_log.Info("[MODULES]: Loading Region's modules"); 492 m_log.Info("[MODULES]: Loading Region's modules");
496 493
@@ -530,9 +527,6 @@ namespace OpenSim
530 // and has to happen before the region is registered with the grid. 527 // and has to happen before the region is registered with the grid.
531 scene.CreateTerrainTexture(true); 528 scene.CreateTerrainTexture(true);
532 scene.RegisterRegionWithGrid(); 529 scene.RegisterRegionWithGrid();
533
534 //Server side object editing permissions checking
535 scene.PermissionsMngr.BypassPermissions = !m_permissions;
536 530
537 // We need to do this after we've initialized the scripting engines. 531 // We need to do this after we've initialized the scripting engines.
538 scene.StartScripts(); 532 scene.StartScripts();
@@ -565,10 +559,9 @@ namespace OpenSim
565 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 559 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
566 AgentCircuitManager circuitManager) 560 AgentCircuitManager circuitManager)
567 { 561 {
568 PermissionManager permissionManager = new PermissionManager();
569 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); 562 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
570 return 563 return
571 new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, 564 new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
572 storageManager, m_httpServer, 565 storageManager, m_httpServer,
573 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor); 566 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor);
574 } 567 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index f2271fb..f7d6f9e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4956,13 +4956,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4956 { 4956 {
4957 case "getinfo": 4957 case "getinfo":
4958 4958
4959 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId)) 4959 if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
4960 { 4960 {
4961 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice); 4961 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
4962 } 4962 }
4963 break; 4963 break;
4964 case "setregioninfo": 4964 case "setregioninfo":
4965 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId)) 4965 if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
4966 { 4966 {
4967 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter), 4967 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter),
4968 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), 4968 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
@@ -4975,7 +4975,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4975 4975
4976 break; 4976 break;
4977 case "texturebase": 4977 case "texturebase":
4978 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId)) 4978 if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
4979 { 4979 {
4980 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 4980 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
4981 { 4981 {
@@ -4990,7 +4990,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4990 } 4990 }
4991 break; 4991 break;
4992 case "texturedetail": 4992 case "texturedetail":
4993 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId)) 4993 if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
4994 { 4994 {
4995 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 4995 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
4996 { 4996 {
@@ -5008,7 +5008,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5008 5008
5009 break; 5009 break;
5010 case "textureheights": 5010 case "textureheights":
5011 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId)) 5011 if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
5012 { 5012 {
5013 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5013 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5014 { 5014 {
@@ -5029,7 +5029,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5029 OnCommitEstateTerrainTextureRequest(this); 5029 OnCommitEstateTerrainTextureRequest(this);
5030 break; 5030 break;
5031 case "setregionterrain": 5031 case "setregionterrain":
5032 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId)) 5032 if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
5033 { 5033 {
5034 if (messagePacket.ParamList.Length != 9) 5034 if (messagePacket.ParamList.Length != 9)
5035 { 5035 {
@@ -5064,7 +5064,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5064 5064
5065 break; 5065 break;
5066 case "restart": 5066 case "restart":
5067 if (((Scene)m_scene).PermissionsMngr.CanRestartSim(this.AgentId)) 5067 if (((Scene)m_scene).Permissions.CanRestartSim(this.AgentId))
5068 { 5068 {
5069 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. 5069 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
5070 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5070 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
@@ -5078,7 +5078,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5078 } 5078 }
5079 break; 5079 break;
5080 case "estatechangecovenantid": 5080 case "estatechangecovenantid":
5081 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId)) 5081 if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
5082 { 5082 {
5083 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5083 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5084 { 5084 {
@@ -5088,7 +5088,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5088 } 5088 }
5089 break; 5089 break;
5090 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too. 5090 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
5091 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId)) 5091 if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
5092 { 5092 {
5093 int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter)); 5093 int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter));
5094 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter))); 5094 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)));
@@ -5096,7 +5096,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5096 } 5096 }
5097 break; 5097 break;
5098 case "simulatormessage": 5098 case "simulatormessage":
5099 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId)) 5099 if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
5100 { 5100 {
5101 LLUUID invoice = messagePacket.MethodData.Invoice; 5101 LLUUID invoice = messagePacket.MethodData.Invoice;
5102 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); 5102 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@@ -5107,7 +5107,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5107 } 5107 }
5108 break; 5108 break;
5109 case "instantmessage": 5109 case "instantmessage":
5110 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId)) 5110 if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
5111 { 5111 {
5112 LLUUID invoice = messagePacket.MethodData.Invoice; 5112 LLUUID invoice = messagePacket.MethodData.Invoice;
5113 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); 5113 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@@ -5118,7 +5118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5118 } 5118 }
5119 break; 5119 break;
5120 case "setregiondebug": 5120 case "setregiondebug":
5121 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId)) 5121 if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
5122 { 5122 {
5123 LLUUID invoice = messagePacket.MethodData.Invoice; 5123 LLUUID invoice = messagePacket.MethodData.Invoice;
5124 LLUUID SenderID = messagePacket.AgentData.AgentID; 5124 LLUUID SenderID = messagePacket.AgentData.AgentID;
@@ -5130,7 +5130,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5130 } 5130 }
5131 break; 5131 break;
5132 case "teleporthomeuser": 5132 case "teleporthomeuser":
5133 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId)) 5133 if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
5134 { 5134 {
5135 LLUUID invoice = messagePacket.MethodData.Invoice; 5135 LLUUID invoice = messagePacket.MethodData.Invoice;
5136 LLUUID SenderID = messagePacket.AgentData.AgentID; 5136 LLUUID SenderID = messagePacket.AgentData.AgentID;
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index ba0b9b4..1dcab20 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -107,12 +107,12 @@ namespace OpenSim.Region.ClientStack
107 return physicsPluginManager.GetPhysicsScene(engine, meshEngine); 107 return physicsPluginManager.GetPhysicsScene(engine, meshEngine);
108 } 108 }
109 109
110 protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer, bool m_permissions) 110 protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer)
111 { 111 {
112 return SetupScene(regionInfo, 0, out clientServer, m_permissions); 112 return SetupScene(regionInfo, 0, out clientServer);
113 } 113 }
114 114
115 protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out IClientNetworkServer clientServer, bool m_permissions) 115 protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out IClientNetworkServer clientServer)
116 { 116 {
117 AgentCircuitManager circuitManager = new AgentCircuitManager(); 117 AgentCircuitManager circuitManager = new AgentCircuitManager();
118 IPAddress listenIP = regionInfo.InternalEndPoint.Address; 118 IPAddress listenIP = regionInfo.InternalEndPoint.Address;
@@ -162,8 +162,9 @@ namespace OpenSim.Region.ClientStack
162 scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero; 162 scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero;
163 } 163 }
164 164
165 scene.LoadPrimsFromStorage(m_permissions, regionInfo.originRegionID); 165 scene.LoadPrimsFromStorage(regionInfo.originRegionID);
166 scene.StartTimer(); 166 scene.StartTimer();
167
167 return scene; 168 return scene;
168 } 169 }
169 170
diff --git a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs
new file mode 100644
index 0000000..ad8e139
--- /dev/null
+++ b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs
@@ -0,0 +1,103 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using libsecondlife;
29
30namespace OpenSim.Region.Environment.Interfaces
31{
32 public interface IScenePermissions
33 {
34 bool BypassPermissions { get; set; }
35
36 #region Object Permissions
37
38 bool CanRezObject(LLUUID user, LLVector3 position);
39
40 /// <summary>
41 /// Permissions check - can user delete an object?
42 /// </summary>
43 /// <param name="user">User attempting the delete</param>
44 /// <param name="obj">Target object</param>
45 /// <returns>Has permission?</returns>
46 bool CanDeRezObject(LLUUID user, LLUUID obj);
47
48 bool CanCopyObject(LLUUID user, LLUUID obj);
49
50 bool CanEditObject(LLUUID user, LLUUID obj);
51
52 bool CanEditObjectPosition(LLUUID user, LLUUID obj);
53
54 /// <summary>
55 /// Permissions check - can user enter an object?
56 /// </summary>
57 /// <param name="user">User attempting move an object</param>
58 /// <param name="oldPos">Source object-position</param>
59 /// <param name="newPos">Target object-position</param>
60 /// <returns>Has permission?</returns>
61 bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos);
62
63 bool CanReturnObject(LLUUID user, LLUUID obj);
64
65 #endregion
66
67 #region Uncategorized permissions
68
69 bool CanInstantMessage(LLUUID user, LLUUID target);
70
71 bool CanInventoryTransfer(LLUUID user, LLUUID target);
72
73 bool CanEditScript(LLUUID user, LLUUID script);
74
75 bool CanRunScript(LLUUID user, LLUUID script);
76
77 bool CanRunConsoleCommand(LLUUID user);
78
79 bool CanTerraform(LLUUID user, LLVector3 position);
80
81 #endregion
82
83 #region Estate Permissions
84
85 bool IsEstateManager(LLUUID user);
86
87 bool GenericEstatePermission(LLUUID user);
88
89 bool CanEditEstateTerrain(LLUUID user);
90
91 bool CanRestartSim(LLUUID user);
92
93 bool CanEditParcel(LLUUID user, ILandObject parcel);
94
95 bool CanSellParcel(LLUUID user, ILandObject parcel);
96
97 bool CanAbandonParcel(LLUUID user, ILandObject parcel);
98
99 #endregion
100
101 uint GenerateClientFlags(LLUUID user, LLUUID objID);
102 }
103}
diff --git a/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs b/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
index 8e90d17..c7ee233 100644
--- a/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
@@ -41,10 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
41 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); 41 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
42 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 42 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
43 43
44 public XferModule()
45 {
46 }
47
48 #region IRegionModule Members 44 #region IRegionModule Members
49 45
50 public void Initialise(Scene scene, IConfigSource config) 46 public void Initialise(Scene scene, IConfigSource config)
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
index 403ab5b..ebe0357 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
205 205
206 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 206 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
207 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates 207 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
208 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) 208 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.Permissions.BypassPermissions)
209 { 209 {
210 m_scene.RegionInfo.EstateSettings.AddEstateManager(user); 210 m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
211 remote_client.sendEstateManagersList(invoice); 211 remote_client.sendEstateManagersList(invoice);
@@ -219,7 +219,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
219 case 512: 219 case 512:
220 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 220 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
221 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates 221 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
222 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) 222 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.Permissions.BypassPermissions)
223 { 223 {
224 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); 224 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
225 remote_client.sendEstateManagersList(invoice); 225 remote_client.sendEstateManagersList(invoice);
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index fd8387b..de02702 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -26,12 +26,14 @@
26 */ 26 */
27 27
28using libsecondlife; 28using libsecondlife;
29using Nini.Config;
30
29using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
31 33
32namespace OpenSim.Region.Environment 34namespace OpenSim.Region.Environment.Modules.World.Permissions
33{ 35{
34 public class PermissionManager 36 public class PermissionsModule : IRegionModule, IScenePermissions
35 { 37 {
36 protected Scene m_scene; 38 protected Scene m_scene;
37 39
@@ -43,11 +45,9 @@ namespace OpenSim.Region.Environment
43 private uint PERM_MOVE = (uint)524288; 45 private uint PERM_MOVE = (uint)524288;
44 //private uint PERM_TRANS = (uint)8192; 46 //private uint PERM_TRANS = (uint)8192;
45 private uint PERM_LOCKED = (uint)540672; 47 private uint PERM_LOCKED = (uint)540672;
46 // Bypasses the permissions engine (always returns OK) 48
47 // disable in any production environment 49 // Bypasses the permissions engine
48 // TODO: Change this to false when permissions are a desired default 50 private bool m_bypassPermissions = false;
49 // TODO: Move to configuration option.
50 private bool m_bypassPermissions = true;
51 51
52 public bool BypassPermissions 52 public bool BypassPermissions
53 { 53 {
@@ -55,20 +55,40 @@ namespace OpenSim.Region.Environment
55 set { m_bypassPermissions = value; } 55 set { m_bypassPermissions = value; }
56 } 56 }
57 57
58 public PermissionManager() 58 #region IRegionModule Members
59
60 public void Initialise(Scene scene, IConfigSource config)
59 { 61 {
62 m_scene = scene;
63
64 // FIXME: Possibly move all permissions related stuff to its own section
65 IConfig myConfig = config.Configs["Startup"];
66
67 m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false);
68
69 m_scene.RegisterModuleInterface<IScenePermissions>(this);
60 } 70 }
61 71
62 public PermissionManager(Scene scene) 72 public void PostInitialise()
63 { 73 {
64 m_scene = scene;
65 } 74 }
66 75
67 public void Initialise(Scene scene) 76 public void Close()
68 { 77 {
69 m_scene = scene;
70 } 78 }
71 79
80 public string Name
81 {
82 get { return "PermissionsModule"; }
83 }
84
85 public bool IsSharedModule
86 {
87 get { return false; }
88 }
89
90 #endregion
91
72 protected virtual void SendPermissionError(LLUUID user, string reason) 92 protected virtual void SendPermissionError(LLUUID user, string reason)
73 { 93 {
74 m_scene.EventManager.TriggerPermissionError(user, reason); 94 m_scene.EventManager.TriggerPermissionError(user, reason);
@@ -159,17 +179,9 @@ namespace OpenSim.Region.Environment
159 return permission; 179 return permission;
160 } 180 }
161 181
162 /// <summary> 182 /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see>
163 /// Permissions check - can user enter an object?
164 /// </summary>
165 /// <param name="user">User attempting move an object</param>
166 /// <param name="oldPos">Source object-position</param>
167 /// <param name="newPos">Target object-position</param>
168 /// <returns>Has permission?</returns>
169 public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos) 183 public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
170 { 184 {
171
172
173 if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f)) 185 if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f))
174 { 186 {
175 return true; 187 return true;
@@ -214,7 +226,6 @@ namespace OpenSim.Region.Environment
214 226
215 public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID) 227 public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
216 { 228 {
217
218 // Here's the way this works, 229 // Here's the way this works,
219 // ObjectFlags and Permission flags are two different enumerations 230 // ObjectFlags and Permission flags are two different enumerations
220 // ObjectFlags, however, tells the client to change what it will allow the user to do. 231 // ObjectFlags, however, tells the client to change what it will allow the user to do.
@@ -296,8 +307,6 @@ namespace OpenSim.Region.Environment
296 return objectEveryoneMask; 307 return objectEveryoneMask;
297 } 308 }
298 309
299
300
301 private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask) 310 private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
302 { 311 {
303 // We are adding the temporary objectflags to the object's objectflags based on the 312 // We are adding the temporary objectflags to the object's objectflags based on the
@@ -395,12 +404,7 @@ namespace OpenSim.Region.Environment
395 return permission; 404 return permission;
396 } 405 }
397 406
398 /// <summary> 407 /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see>
399 /// Permissions check - can user delete an object?
400 /// </summary>
401 /// <param name="user">User attempting the delete</param>
402 /// <param name="obj">Target object</param>
403 /// <returns>Has permission?</returns>
404 public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) 408 public virtual bool CanDeRezObject(LLUUID user, LLUUID obj)
405 { 409 {
406 return GenericObjectPermission(user, obj); 410 return GenericObjectPermission(user, obj);
@@ -522,7 +526,7 @@ namespace OpenSim.Region.Environment
522 526
523 #region Communication Permissions 527 #region Communication Permissions
524 528
525 public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) 529 protected virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
526 { 530 {
527 bool permission = false; 531 bool permission = false;
528 string reason = "Only registered users may communicate with another account."; 532 string reason = "Only registered users may communicate with another account.";
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
index 240ba65..91a28e4 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
@@ -449,7 +449,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
449 float south, float east, IClientAPI remoteClient) 449 float south, float east, IClientAPI remoteClient)
450 { 450 {
451 // Not a good permissions check, if in area mode, need to check the entire area. 451 // Not a good permissions check, if in area mode, need to check the entire area.
452 if (m_scene.PermissionsMngr.CanTerraform(remoteClient.AgentId, new LLVector3(north, west, 0))) 452 if (m_scene.Permissions.CanTerraform(remoteClient.AgentId, new LLVector3(north, west, 0)))
453 { 453 {
454 if (north == south && east == west) 454 if (north == south && east == west)
455 { 455 {
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index da286ad..f29e1f3 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -63,7 +63,6 @@ namespace OpenSim.Region.Environment.Scenes
63 63
64 protected RegionInfo m_regInfo; 64 protected RegionInfo m_regInfo;
65 protected Scene m_parentScene; 65 protected Scene m_parentScene;
66 protected PermissionManager PermissionsMngr;
67 protected List<EntityBase> m_updateList = new List<EntityBase>(); 66 protected List<EntityBase> m_updateList = new List<EntityBase>();
68 protected int m_numRootAgents = 0; 67 protected int m_numRootAgents = 0;
69 protected int m_numPrim = 0; 68 protected int m_numPrim = 0;
@@ -79,11 +78,10 @@ namespace OpenSim.Region.Environment.Scenes
79 78
80 #endregion 79 #endregion
81 80
82 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) 81 public InnerScene(Scene parent, RegionInfo regInfo)
83 { 82 {
84 m_parentScene = parent; 83 m_parentScene = parent;
85 m_regInfo = regInfo; 84 m_regInfo = regInfo;
86 PermissionsMngr = permissionsMngr;
87 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize); 85 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize);
88 QuadTree.Subdivide(); 86 QuadTree.Subdivide();
89 QuadTree.Subdivide(); 87 QuadTree.Subdivide();
@@ -1031,7 +1029,7 @@ namespace OpenSim.Region.Environment.Scenes
1031 SceneObjectGroup group = GetGroupByPrim(localID); 1029 SceneObjectGroup group = GetGroupByPrim(localID);
1032 if (group != null) 1030 if (group != null)
1033 { 1031 {
1034 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1032 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
1035 { 1033 {
1036 group.Resize(scale, localID); 1034 group.Resize(scale, localID);
1037 } 1035 }
@@ -1042,7 +1040,7 @@ namespace OpenSim.Region.Environment.Scenes
1042 SceneObjectGroup group = GetGroupByPrim(localID); 1040 SceneObjectGroup group = GetGroupByPrim(localID);
1043 if (group != null) 1041 if (group != null)
1044 { 1042 {
1045 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1043 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
1046 { 1044 {
1047 group.GroupResize(scale, localID); 1045 group.GroupResize(scale, localID);
1048 } 1046 }
@@ -1078,7 +1076,7 @@ namespace OpenSim.Region.Environment.Scenes
1078 SceneObjectGroup group = GetGroupByPrim(localID); 1076 SceneObjectGroup group = GetGroupByPrim(localID);
1079 if (group != null) 1077 if (group != null)
1080 { 1078 {
1081 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1079 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
1082 { 1080 {
1083 group.UpdateSingleRotation(rot, localID); 1081 group.UpdateSingleRotation(rot, localID);
1084 } 1082 }
@@ -1096,7 +1094,7 @@ namespace OpenSim.Region.Environment.Scenes
1096 SceneObjectGroup group = GetGroupByPrim(localID); 1094 SceneObjectGroup group = GetGroupByPrim(localID);
1097 if (group != null) 1095 if (group != null)
1098 { 1096 {
1099 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1097 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
1100 { 1098 {
1101 group.UpdateGroupRotation(rot); 1099 group.UpdateGroupRotation(rot);
1102 } 1100 }
@@ -1115,7 +1113,7 @@ namespace OpenSim.Region.Environment.Scenes
1115 SceneObjectGroup group = GetGroupByPrim(localID); 1113 SceneObjectGroup group = GetGroupByPrim(localID);
1116 if (group != null) 1114 if (group != null)
1117 { 1115 {
1118 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1116 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
1119 { 1117 {
1120 group.UpdateGroupRotation(pos, rot); 1118 group.UpdateGroupRotation(pos, rot);
1121 } 1119 }
@@ -1128,12 +1126,12 @@ namespace OpenSim.Region.Environment.Scenes
1128 if (group != null) 1126 if (group != null)
1129 { 1127 {
1130 LLVector3 oldPos = group.AbsolutePosition; 1128 LLVector3 oldPos = group.AbsolutePosition;
1131 if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) 1129 if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
1132 { 1130 {
1133 group.SendGroupTerseUpdate(); 1131 group.SendGroupTerseUpdate();
1134 return; 1132 return;
1135 } 1133 }
1136 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) 1134 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
1137 { 1135 {
1138 group.UpdateSinglePosition(pos, localID); 1136 group.UpdateSinglePosition(pos, localID);
1139 } 1137 }
@@ -1159,12 +1157,12 @@ namespace OpenSim.Region.Environment.Scenes
1159 } 1157 }
1160 else 1158 else
1161 { 1159 {
1162 if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) 1160 if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
1163 { 1161 {
1164 group.SendGroupTerseUpdate(); 1162 group.SendGroupTerseUpdate();
1165 return; 1163 return;
1166 } 1164 }
1167 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) 1165 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
1168 { 1166 {
1169 group.UpdateGroupPosition(pos); 1167 group.UpdateGroupPosition(pos);
1170 } 1168 }
@@ -1183,7 +1181,7 @@ namespace OpenSim.Region.Environment.Scenes
1183 SceneObjectGroup group = GetGroupByPrim(localID); 1181 SceneObjectGroup group = GetGroupByPrim(localID);
1184 if (group != null) 1182 if (group != null)
1185 { 1183 {
1186 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1184 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
1187 { 1185 {
1188 group.UpdateTextureEntry(localID, texture); 1186 group.UpdateTextureEntry(localID, texture);
1189 } 1187 }
@@ -1201,7 +1199,7 @@ namespace OpenSim.Region.Environment.Scenes
1201 SceneObjectGroup group = GetGroupByPrim(localID); 1199 SceneObjectGroup group = GetGroupByPrim(localID);
1202 if (group != null) 1200 if (group != null)
1203 { 1201 {
1204 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) 1202 if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID))
1205 { 1203 {
1206 group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); 1204 group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
1207 } 1205 }
@@ -1213,7 +1211,7 @@ namespace OpenSim.Region.Environment.Scenes
1213 SceneObjectGroup group = GetGroupByPrim(objectID); 1211 SceneObjectGroup group = GetGroupByPrim(objectID);
1214 if (group != null) 1212 if (group != null)
1215 { 1213 {
1216 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.) 1214 if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.)
1217 { 1215 {
1218 group.GrabMovement(offset, pos, remoteClient); 1216 group.GrabMovement(offset, pos, remoteClient);
1219 } 1217 }
@@ -1235,7 +1233,7 @@ namespace OpenSim.Region.Environment.Scenes
1235 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1233 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1236 if (group != null) 1234 if (group != null)
1237 { 1235 {
1238 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) 1236 if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID))
1239 { 1237 {
1240 group.SetPartName(Util.CleanString(name), primLocalID); 1238 group.SetPartName(Util.CleanString(name), primLocalID);
1241 } 1239 }
@@ -1252,7 +1250,7 @@ namespace OpenSim.Region.Environment.Scenes
1252 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1250 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1253 if (group != null) 1251 if (group != null)
1254 { 1252 {
1255 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) 1253 if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID))
1256 { 1254 {
1257 group.SetPartDescription(Util.CleanString(description), primLocalID); 1255 group.SetPartDescription(Util.CleanString(description), primLocalID);
1258 } 1256 }
@@ -1265,7 +1263,7 @@ namespace OpenSim.Region.Environment.Scenes
1265 1263
1266 if (group != null) 1264 if (group != null)
1267 { 1265 {
1268 if (PermissionsMngr.CanEditObject(agentID, group.UUID)) 1266 if (m_parentScene.Permissions.CanEditObject(agentID, group.UUID))
1269 { 1267 {
1270 group.UpdateExtraParam(primLocalID, type, inUse, data); 1268 group.UpdateExtraParam(primLocalID, type, inUse, data);
1271 } 1269 }
@@ -1282,7 +1280,7 @@ namespace OpenSim.Region.Environment.Scenes
1282 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1280 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1283 if (group != null) 1281 if (group != null)
1284 { 1282 {
1285 if (PermissionsMngr.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID))) 1283 if (m_parentScene.Permissions.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID)))
1286 { 1284 {
1287 group.UpdateShape(shapeBlock, primLocalID); 1285 group.UpdateShape(shapeBlock, primLocalID);
1288 } 1286 }
@@ -1448,11 +1446,11 @@ namespace OpenSim.Region.Environment.Scenes
1448 // * Asset/DRM permission bit "modify" is enabled 1446 // * Asset/DRM permission bit "modify" is enabled
1449 //use CanEditObjectPosition 1447 //use CanEditObjectPosition
1450 1448
1451 if (IncludeInSearch && PermissionsMngr.CanEditObject(user, objid)) 1449 if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(user, objid))
1452 { 1450 {
1453 obj.AddFlag(LLObject.ObjectFlags.JointWheel); 1451 obj.AddFlag(LLObject.ObjectFlags.JointWheel);
1454 } 1452 }
1455 else if (!IncludeInSearch && PermissionsMngr.CanEditObjectPosition(user, objid)) 1453 else if (!IncludeInSearch && m_parentScene.Permissions.CanEditObjectPosition(user, objid))
1456 { 1454 {
1457 obj.RemFlag(LLObject.ObjectFlags.JointWheel); 1455 obj.RemFlag(LLObject.ObjectFlags.JointWheel);
1458 } 1456 }
@@ -1485,7 +1483,7 @@ namespace OpenSim.Region.Environment.Scenes
1485 1483
1486 if (originPrim != null) 1484 if (originPrim != null)
1487 { 1485 {
1488 if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID)) 1486 if (m_parentScene.Permissions.CanCopyObject(AgentID, originPrim.UUID))
1489 { 1487 {
1490 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); 1488 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
1491 copy.AbsolutePosition = copy.AbsolutePosition + offset; 1489 copy.AbsolutePosition = copy.AbsolutePosition + offset;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index ee52a66..65e6fd8 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Environment.Scenes
73 remoteClient.SendInventoryItemCreateUpdate(item); 73 remoteClient.SendInventoryItemCreateUpdate(item);
74 74
75 int userlevel = 0; 75 int userlevel = 0;
76 if (PermissionsMngr.IsEstateManager(remoteClient.AgentId)) 76 if (Permissions.IsEstateManager(remoteClient.AgentId))
77 { 77 {
78 userlevel = 1; 78 userlevel = 1;
79 } 79 }
@@ -784,7 +784,7 @@ namespace OpenSim.Region.Environment.Scenes
784 } 784 }
785 785
786// bool permission; 786// bool permission;
787// permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId, 787// permission = Permissions.CanCopyObject(remoteClient.AgentId,
788// ((SceneObjectGroup) selectedEnt).UUID); 788// ((SceneObjectGroup) selectedEnt).UUID);
789 789
790 // Pending resolving upstream problems with permissions, we just won't allow anybody who is not the owner 790 // Pending resolving upstream problems with permissions, we just won't allow anybody who is not the owner
@@ -988,12 +988,12 @@ namespace OpenSim.Region.Environment.Scenes
988 bool permission; 988 bool permission;
989 if (DeRezPacket.AgentBlock.Destination == 1) 989 if (DeRezPacket.AgentBlock.Destination == 1)
990 { // Take Copy 990 { // Take Copy
991 permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId, 991 permission = Permissions.CanCopyObject(remoteClient.AgentId,
992 ((SceneObjectGroup) selectedEnt).UUID); 992 ((SceneObjectGroup) selectedEnt).UUID);
993 } 993 }
994 else 994 else
995 { // Take 995 { // Take
996 permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId, 996 permission = Permissions.CanDeRezObject(remoteClient.AgentId,
997 ((SceneObjectGroup) selectedEnt).UUID); 997 ((SceneObjectGroup) selectedEnt).UUID);
998 } 998 }
999 999
@@ -1267,7 +1267,7 @@ namespace OpenSim.Region.Environment.Scenes
1267 RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), 1267 RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
1268 BypassRayCast, bRayEndIsIntersection,true,scale, false); 1268 BypassRayCast, bRayEndIsIntersection,true,scale, false);
1269 1269
1270 if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos) && !attachment) 1270 if (!Permissions.CanRezObject(remoteClient.AgentId, pos) && !attachment)
1271 { 1271 {
1272 return null; 1272 return null;
1273 } 1273 }
@@ -1361,7 +1361,7 @@ namespace OpenSim.Region.Environment.Scenes
1361 { 1361 {
1362 LLUUID ownerID = item.OwnerID; 1362 LLUUID ownerID = item.OwnerID;
1363 1363
1364 if (!PermissionsMngr.CanRezObject(ownerID, pos)) 1364 if (!Permissions.CanRezObject(ownerID, pos))
1365 { 1365 {
1366 return null; 1366 return null;
1367 } 1367 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index b4a581d..350990e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Scenes
85 if (((SceneObjectGroup) ent).LocalId == primLocalID) 85 if (((SceneObjectGroup) ent).LocalId == primLocalID)
86 { 86 {
87 // A prim is only tainted if it's allowed to be edited by the person clicking it. 87 // A prim is only tainted if it's allowed to be edited by the person clicking it.
88 if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID)) 88 if (Permissions.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || Permissions.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
89 { 89 {
90 ((SceneObjectGroup) ent).GetProperties(remoteClient); 90 ((SceneObjectGroup) ent).GetProperties(remoteClient);
91 ((SceneObjectGroup) ent).IsSelected = true; 91 ((SceneObjectGroup) ent).IsSelected = true;
@@ -112,7 +112,7 @@ namespace OpenSim.Region.Environment.Scenes
112 { 112 {
113 if (((SceneObjectGroup) ent).LocalId == primLocalID) 113 if (((SceneObjectGroup) ent).LocalId == primLocalID)
114 { 114 {
115 if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID)) 115 if (Permissions.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || Permissions.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
116 { 116 {
117 ((SceneObjectGroup) ent).IsSelected = false; 117 ((SceneObjectGroup) ent).IsSelected = false;
118 LandChannel.setPrimsTainted(); 118 LandChannel.setPrimsTainted();
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f861361..a703622 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -114,6 +114,7 @@ namespace OpenSim.Region.Environment.Scenes
114 protected IXMLRPC m_xmlrpcModule; 114 protected IXMLRPC m_xmlrpcModule;
115 protected IWorldComm m_worldCommModule; 115 protected IWorldComm m_worldCommModule;
116 protected IAvatarFactory m_AvatarFactory; 116 protected IAvatarFactory m_AvatarFactory;
117 protected IScenePermissions m_permissions;
117 118
118 // Central Update Loop 119 // Central Update Loop
119 120
@@ -169,13 +170,12 @@ namespace OpenSim.Region.Environment.Scenes
169 get { return m_timedilation; } 170 get { return m_timedilation; }
170 } 171 }
171 172
172 protected readonly PermissionManager m_permissionManager; 173 /// <summary>
173 // This is the instance to the permissions manager. 174 /// The reference by which general permissions in the scene can be set and queried.
174 // This manages permissions to clients on in world objects 175 /// </summary>
175 176 public IScenePermissions Permissions
176 public PermissionManager PermissionsMngr
177 { 177 {
178 get { return m_permissionManager; } 178 get { return m_permissions; }
179 } 179 }
180 180
181 public int TimePhase 181 public int TimePhase
@@ -219,7 +219,7 @@ namespace OpenSim.Region.Environment.Scenes
219 219
220 #region Constructors 220 #region Constructors
221 221
222 public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, 222 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
223 CommunicationsManager commsMan, SceneCommunicationService sceneGridService, 223 CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
224 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, 224 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
225 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor) 225 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor)
@@ -248,10 +248,7 @@ namespace OpenSim.Region.Environment.Scenes
248 EventManager.OnLandObjectRemoved += 248 EventManager.OnLandObjectRemoved +=
249 new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); 249 new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
250 250
251 m_permissionManager = permissionManager; 251 m_innerScene = new InnerScene(this, m_regInfo);
252 m_permissionManager.Initialise(this);
253
254 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
255 252
256 // If the Inner scene has an Unrecoverable error, restart this sim. 253 // If the Inner scene has an Unrecoverable error, restart this sim.
257 // Currently the only thing that causes it to happen is two kinds of specific 254 // Currently the only thing that causes it to happen is two kinds of specific
@@ -613,6 +610,9 @@ namespace OpenSim.Region.Environment.Scenes
613 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 610 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
614 } 611 }
615 612
613 /// <summary>
614 /// Sets up references to loaded modules required by thie scene
615 /// </summary>
616 public void SetModuleInterfaces() 616 public void SetModuleInterfaces()
617 { 617 {
618 m_simChatModule = RequestModuleInterface<ISimChat>(); 618 m_simChatModule = RequestModuleInterface<ISimChat>();
@@ -621,6 +621,7 @@ namespace OpenSim.Region.Environment.Scenes
621 m_worldCommModule = RequestModuleInterface<IWorldComm>(); 621 m_worldCommModule = RequestModuleInterface<IWorldComm>();
622 XferManager = RequestModuleInterface<IXfer>(); 622 XferManager = RequestModuleInterface<IXfer>();
623 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); 623 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
624 m_permissions = RequestModuleInterface<IScenePermissions>();
624 } 625 }
625 626
626 #endregion 627 #endregion
@@ -1121,7 +1122,7 @@ namespace OpenSim.Region.Environment.Scenes
1121 /// <summary> 1122 /// <summary>
1122 /// Loads the World's objects 1123 /// Loads the World's objects
1123 /// </summary> 1124 /// </summary>
1124 public virtual void LoadPrimsFromStorage(bool m_permissions, LLUUID regionID) 1125 public virtual void LoadPrimsFromStorage(LLUUID regionID)
1125 { 1126 {
1126 m_log.Info("[SCENE]: Loading objects from datastore"); 1127 m_log.Info("[SCENE]: Loading objects from datastore");
1127 1128
@@ -1243,12 +1244,11 @@ namespace OpenSim.Region.Environment.Scenes
1243 1244
1244 LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false); 1245 LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false);
1245 1246
1246 if (PermissionsMngr.CanRezObject(ownerID, pos)) 1247 if (Permissions.CanRezObject(ownerID, pos))
1247 { 1248 {
1248 // rez ON the ground, not IN the ground 1249 // rez ON the ground, not IN the ground
1249 pos.Z += 0.25F; 1250 pos.Z += 0.25F;
1250 1251
1251
1252 AddNewPrim(ownerID, pos, rot, shape); 1252 AddNewPrim(ownerID, pos, rot, shape);
1253 } 1253 }
1254 } 1254 }
@@ -2499,7 +2499,7 @@ namespace OpenSim.Region.Environment.Scenes
2499 IClientAPI controllingClient) 2499 IClientAPI controllingClient)
2500 { 2500 {
2501 // First check that this is the sim owner 2501 // First check that this is the sim owner
2502 if (m_permissionManager.GenericEstatePermission(agentID)) 2502 if (Permissions.GenericEstatePermission(agentID))
2503 { 2503 {
2504 // User needs to be logged into this sim 2504 // User needs to be logged into this sim
2505 if (m_scenePresences.ContainsKey(agentID)) 2505 if (m_scenePresences.ContainsKey(agentID))
@@ -2577,7 +2577,7 @@ namespace OpenSim.Region.Environment.Scenes
2577 LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb"); 2577 LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb");
2578 if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) 2578 if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID)
2579 { 2579 {
2580 if (m_permissionManager.GenericEstatePermission(godID)) 2580 if (Permissions.GenericEstatePermission(godID))
2581 { 2581 {
2582 if (agentID == kickUserID) 2582 if (agentID == kickUserID)
2583 { 2583 {
@@ -2896,7 +2896,7 @@ namespace OpenSim.Region.Environment.Scenes
2896 } 2896 }
2897 else if ((parcel.landData.landFlags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0) 2897 else if ((parcel.landData.landFlags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0)
2898 { 2898 {
2899 if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || PermissionsMngr.GenericEstatePermission(part.OwnerID)) 2899 if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || Permissions.GenericEstatePermission(part.OwnerID))
2900 { 2900 {
2901 return true; 2901 return true;
2902 } 2902 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 2dfea2a..8603ccc 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Scenes
191 191
192 public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) 192 public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
193 { 193 {
194 ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); 194 ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.BypassPermissions = bypassPermissions; });
195 } 195 }
196 196
197 private void ForEachCurrentScene(Action<Scene> func) 197 private void ForEachCurrentScene(Action<Scene> func)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 9ed5990..2e44c54 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1340,7 +1340,7 @@ namespace OpenSim.Region.Environment.Scenes
1340 if (part.OwnerID != cAgentID) 1340 if (part.OwnerID != cAgentID)
1341 { 1341 {
1342 // Apply Next Owner Permissions if we're not bypassing permissions 1342 // Apply Next Owner Permissions if we're not bypassing permissions
1343 if (!m_scene.PermissionsMngr.BypassPermissions) 1343 if (!m_scene.Permissions.BypassPermissions)
1344 m_rootPart.ApplyNextOwnerPermissions(); 1344 m_rootPart.ApplyNextOwnerPermissions();
1345 } 1345 }
1346 1346
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 453c18f..fcd93d8 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -451,7 +451,7 @@ namespace OpenSim.Region.Environment.Scenes
451 451
452 public uint GenerateClientFlags(LLUUID ObjectID) 452 public uint GenerateClientFlags(LLUUID ObjectID)
453 { 453 {
454 return m_scene.PermissionsMngr.GenerateClientFlags(m_uuid, ObjectID); 454 return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
455 } 455 }
456 456
457 /// <summary> 457 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index ca94dd7..54c26d9 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -180,8 +180,8 @@ namespace OpenSim.Region.ScriptEngine.Common
180 { 180 {
181 m_host.AddScriptLPS(1); 181 m_host.AddScriptLPS(1);
182 //Check to make sure that the script's owner is the estate manager/master 182 //Check to make sure that the script's owner is the estate manager/master
183 //World.PermissionsMngr.GenericEstatePermission( 183 //World.Permissions.GenericEstatePermission(
184 if (World.PermissionsMngr.GenericEstatePermission(m_host.OwnerID)) 184 if (World.Permissions.GenericEstatePermission(m_host.OwnerID))
185 { 185 {
186 World.EventManager.TriggerRequestChangeWaterHeight((float)height); 186 World.EventManager.TriggerRequestChangeWaterHeight((float)height);
187 } 187 }
@@ -2616,7 +2616,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2616 public void llModifyLand(int action, int brush) 2616 public void llModifyLand(int action, int brush)
2617 { 2617 {
2618 m_host.AddScriptLPS(1); 2618 m_host.AddScriptLPS(1);
2619 if (World.PermissionsMngr.CanTerraform(m_host.OwnerID, new LLVector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0))) 2619 if (World.Permissions.CanTerraform(m_host.OwnerID, new LLVector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0)))
2620 { 2620 {
2621 NotImplemented("llModifyLand"); 2621 NotImplemented("llModifyLand");
2622 } 2622 }
@@ -3869,7 +3869,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3869 { 3869 {
3870 if (m_host.ObjectOwner == parcel.landData.ownerID || 3870 if (m_host.ObjectOwner == parcel.landData.ownerID ||
3871 (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.groupID 3871 (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.groupID
3872 && parcel.landData.isGroupOwned) || World.PermissionsMngr.GenericEstatePermission(m_host.OwnerID)) 3872 && parcel.landData.isGroupOwned) || World.Permissions.GenericEstatePermission(m_host.OwnerID))
3873 { 3873 {
3874 av.StandUp(); 3874 av.StandUp();
3875 } 3875 }
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
index 731168d..ddca617 100644
--- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
@@ -258,7 +258,7 @@ namespace OpenSim.Region.ScriptEngine.Common
258 if (x > 255 || x < 0 || y > 255 || y < 0) 258 if (x > 255 || x < 0 || y > 255 || y < 0)
259 LSLError("osTerrainSetHeight: Coordinate out of bounds"); 259 LSLError("osTerrainSetHeight: Coordinate out of bounds");
260 260
261 if (World.PermissionsMngr.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0))) 261 if (World.Permissions.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0)))
262 { 262 {
263 World.Heightmap[x, y] = val; 263 World.Heightmap[x, y] = val;
264 return 1; 264 return 1;
@@ -281,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Common
281 public int osRegionRestart(double seconds) 281 public int osRegionRestart(double seconds)
282 { 282 {
283 m_host.AddScriptLPS(1); 283 m_host.AddScriptLPS(1);
284 if (World.PermissionsMngr.CanRestartSim(m_host.OwnerID)) 284 if (World.Permissions.CanRestartSim(m_host.OwnerID))
285 { 285 {
286 World.Restart((float)seconds); 286 World.Restart((float)seconds);
287 return 1; 287 return 1;
@@ -406,7 +406,7 @@ namespace OpenSim.Region.ScriptEngine.Common
406 406
407 if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false)) 407 if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false))
408 { 408 {
409 if (World.PermissionsMngr.CanRunConsoleCommand(m_host.OwnerID)) 409 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
410 { 410 {
411 MainConsole.Instance.RunCommand(command); 411 MainConsole.Instance.RunCommand(command);
412 return true; 412 return true;