diff options
author | mingchen | 2008-05-08 19:37:57 +0000 |
---|---|---|
committer | mingchen | 2008-05-08 19:37:57 +0000 |
commit | 6c71a04da8150f7948df7a43f532e525d44cc4e7 (patch) | |
tree | e9ed76fd72fa84f9aad4ff5dec66972e08e93b82 /OpenSim/Region | |
parent | * Committing an extra bit of permissions for attaching to ensure that the per... (diff) | |
download | opensim-SC-6c71a04da8150f7948df7a43f532e525d44cc4e7.zip opensim-SC-6c71a04da8150f7948df7a43f532e525d44cc4e7.tar.gz opensim-SC-6c71a04da8150f7948df7a43f532e525d44cc4e7.tar.bz2 opensim-SC-6c71a04da8150f7948df7a43f532e525d44cc4e7.tar.xz |
*Added all the permission checks to the sceneexternalchecks and modified permission module to follow this.
*This makes permission checking much more modular; allows restrictive and granting module to be made without modifying the existing permission module
Diffstat (limited to 'OpenSim/Region')
11 files changed, 658 insertions, 207 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 51c7184..5bd2e6c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -5070,13 +5070,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5070 | { | 5070 | { |
5071 | case "getinfo": | 5071 | case "getinfo": |
5072 | 5072 | ||
5073 | if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) | 5073 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) |
5074 | { | 5074 | { |
5075 | OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice); | 5075 | OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice); |
5076 | } | 5076 | } |
5077 | break; | 5077 | break; |
5078 | case "setregioninfo": | 5078 | case "setregioninfo": |
5079 | if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) | 5079 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) |
5080 | { | 5080 | { |
5081 | OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter), | 5081 | OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter), |
5082 | convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), | 5082 | convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), |
@@ -5089,7 +5089,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5089 | 5089 | ||
5090 | break; | 5090 | break; |
5091 | case "texturebase": | 5091 | case "texturebase": |
5092 | if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) | 5092 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) |
5093 | { | 5093 | { |
5094 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | 5094 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) |
5095 | { | 5095 | { |
@@ -5104,7 +5104,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5104 | } | 5104 | } |
5105 | break; | 5105 | break; |
5106 | case "texturedetail": | 5106 | case "texturedetail": |
5107 | if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) | 5107 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) |
5108 | { | 5108 | { |
5109 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | 5109 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) |
5110 | { | 5110 | { |
@@ -5122,7 +5122,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5122 | 5122 | ||
5123 | break; | 5123 | break; |
5124 | case "textureheights": | 5124 | case "textureheights": |
5125 | if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) | 5125 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) |
5126 | { | 5126 | { |
5127 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | 5127 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) |
5128 | { | 5128 | { |
@@ -5143,7 +5143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5143 | OnCommitEstateTerrainTextureRequest(this); | 5143 | OnCommitEstateTerrainTextureRequest(this); |
5144 | break; | 5144 | break; |
5145 | case "setregionterrain": | 5145 | case "setregionterrain": |
5146 | if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) | 5146 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) |
5147 | { | 5147 | { |
5148 | if (messagePacket.ParamList.Length != 9) | 5148 | if (messagePacket.ParamList.Length != 9) |
5149 | { | 5149 | { |
@@ -5178,7 +5178,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5178 | 5178 | ||
5179 | break; | 5179 | break; |
5180 | case "restart": | 5180 | case "restart": |
5181 | if (((Scene)m_scene).Permissions.CanRestartSim(this.AgentId)) | 5181 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanRestartSim(this.AgentId)) |
5182 | { | 5182 | { |
5183 | // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. | 5183 | // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. |
5184 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | 5184 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) |
@@ -5192,7 +5192,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5192 | } | 5192 | } |
5193 | break; | 5193 | break; |
5194 | case "estatechangecovenantid": | 5194 | case "estatechangecovenantid": |
5195 | if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) | 5195 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) |
5196 | { | 5196 | { |
5197 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | 5197 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) |
5198 | { | 5198 | { |
@@ -5202,7 +5202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5202 | } | 5202 | } |
5203 | break; | 5203 | break; |
5204 | case "estateaccessdelta": // Estate access delta manages the banlist and allow list too. | 5204 | case "estateaccessdelta": // Estate access delta manages the banlist and allow list too. |
5205 | if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) | 5205 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) |
5206 | { | 5206 | { |
5207 | int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter)); | 5207 | int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter)); |
5208 | OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter))); | 5208 | OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter))); |
@@ -5210,7 +5210,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5210 | } | 5210 | } |
5211 | break; | 5211 | break; |
5212 | case "simulatormessage": | 5212 | case "simulatormessage": |
5213 | if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) | 5213 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) |
5214 | { | 5214 | { |
5215 | LLUUID invoice = messagePacket.MethodData.Invoice; | 5215 | LLUUID invoice = messagePacket.MethodData.Invoice; |
5216 | LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); | 5216 | LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); |
@@ -5221,7 +5221,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5221 | } | 5221 | } |
5222 | break; | 5222 | break; |
5223 | case "instantmessage": | 5223 | case "instantmessage": |
5224 | if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) | 5224 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) |
5225 | { | 5225 | { |
5226 | LLUUID invoice = messagePacket.MethodData.Invoice; | 5226 | LLUUID invoice = messagePacket.MethodData.Invoice; |
5227 | LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); | 5227 | LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); |
@@ -5232,7 +5232,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5232 | } | 5232 | } |
5233 | break; | 5233 | break; |
5234 | case "setregiondebug": | 5234 | case "setregiondebug": |
5235 | if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) | 5235 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) |
5236 | { | 5236 | { |
5237 | LLUUID invoice = messagePacket.MethodData.Invoice; | 5237 | LLUUID invoice = messagePacket.MethodData.Invoice; |
5238 | LLUUID SenderID = messagePacket.AgentData.AgentID; | 5238 | LLUUID SenderID = messagePacket.AgentData.AgentID; |
@@ -5244,7 +5244,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5244 | } | 5244 | } |
5245 | break; | 5245 | break; |
5246 | case "teleporthomeuser": | 5246 | case "teleporthomeuser": |
5247 | if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) | 5247 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) |
5248 | { | 5248 | { |
5249 | LLUUID invoice = messagePacket.MethodData.Invoice; | 5249 | LLUUID invoice = messagePacket.MethodData.Invoice; |
5250 | LLUUID SenderID = messagePacket.AgentData.AgentID; | 5250 | LLUUID SenderID = messagePacket.AgentData.AgentID; |
diff --git a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs index 5d161bb..06c6611 100644 --- a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs +++ b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs | |||
@@ -32,72 +32,6 @@ namespace OpenSim.Region.Environment.Interfaces | |||
32 | public interface IScenePermissions | 32 | public interface IScenePermissions |
33 | { | 33 | { |
34 | bool BypassPermissions { get; set; } | 34 | bool BypassPermissions { get; set; } |
35 | |||
36 | #region Object Permissions | ||
37 | |||
38 | bool CanRezObject(LLUUID user, LLVector3 position, int count); | ||
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); | 35 | uint GenerateClientFlags(LLUUID user, LLUUID objID); |
102 | } | 36 | } |
103 | } | 37 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 7bd1bb3..16cd211 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -61,12 +61,33 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
61 | { | 61 | { |
62 | m_scene = scene; | 62 | m_scene = scene; |
63 | 63 | ||
64 | // FIXME: Possibly move all permissions related stuff to its own section | ||
65 | IConfig myConfig = config.Configs["Startup"]; | 64 | IConfig myConfig = config.Configs["Startup"]; |
66 | 65 | ||
67 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false); | 66 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); |
68 | 67 | ||
69 | m_scene.RegisterModuleInterface<IScenePermissions>(this); | 68 | m_scene.RegisterModuleInterface<IScenePermissions>(this); |
69 | |||
70 | //Register External Permission Checks! | ||
71 | m_scene.ExternalChecks.addCheckAbandonParcel(this.CanAbandonParcel); | ||
72 | m_scene.ExternalChecks.addCheckCopyObject(this.CanCopyObject); | ||
73 | m_scene.ExternalChecks.addCheckDeRezObject(this.CanDeRezObject); | ||
74 | m_scene.ExternalChecks.addCheckEditEstateTerrain(this.CanEditEstateTerrain); | ||
75 | m_scene.ExternalChecks.addCheckEditObject(this.CanEditObject); | ||
76 | m_scene.ExternalChecks.addCheckEditParcel(this.CanEditParcel); | ||
77 | m_scene.ExternalChecks.addCheckEditScript(this.CanEditScript); | ||
78 | m_scene.ExternalChecks.addCheckInstantMessage(this.CanInstantMessage); | ||
79 | m_scene.ExternalChecks.addCheckInventoryTransfer(this.CanInventoryTransfer); | ||
80 | m_scene.ExternalChecks.addCheckMoveObject(this.CanEditObjectPosition); | ||
81 | m_scene.ExternalChecks.addCheckRestartSim(this.CanRestartSim); | ||
82 | m_scene.ExternalChecks.addCheckReturnObject(this.CanReturnObject); | ||
83 | m_scene.ExternalChecks.addCheckRezObject(this.CanRezObject); | ||
84 | m_scene.ExternalChecks.addCheckBeGodLike(this.CanBeGodLike); | ||
85 | m_scene.ExternalChecks.addCheckRunConsoleCommand(this.CanRunConsoleCommand); | ||
86 | m_scene.ExternalChecks.addCheckRunScript(this.CanRunScript); | ||
87 | m_scene.ExternalChecks.addCheckSellParcel(this.CanSellParcel); | ||
88 | //m_scene.ExternalChecks.addCheckTakeObject; -- NOT YET IMPLEMENTED | ||
89 | m_scene.ExternalChecks.addCheckTerraformLandCommand(this.CanTerraform); | ||
90 | |||
70 | } | 91 | } |
71 | 92 | ||
72 | public void PostInitialise() | 93 | public void PostInitialise() |
@@ -89,12 +110,12 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
89 | 110 | ||
90 | #endregion | 111 | #endregion |
91 | 112 | ||
92 | protected virtual void SendPermissionError(LLUUID user, string reason) | 113 | protected void SendPermissionError(LLUUID user, string reason) |
93 | { | 114 | { |
94 | m_scene.EventManager.TriggerPermissionError(user, reason); | 115 | m_scene.EventManager.TriggerPermissionError(user, reason); |
95 | } | 116 | } |
96 | 117 | ||
97 | protected virtual bool IsAdministrator(LLUUID user) | 118 | protected bool IsAdministrator(LLUUID user) |
98 | { | 119 | { |
99 | if (m_bypassPermissions) | 120 | if (m_bypassPermissions) |
100 | { | 121 | { |
@@ -110,7 +131,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
110 | return false; | 131 | return false; |
111 | } | 132 | } |
112 | 133 | ||
113 | public virtual bool IsEstateManager(LLUUID user) | 134 | public bool IsEstateManager(LLUUID user) |
114 | { | 135 | { |
115 | if (m_bypassPermissions) | 136 | if (m_bypassPermissions) |
116 | { | 137 | { |
@@ -130,17 +151,17 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
130 | return false; | 151 | return false; |
131 | } | 152 | } |
132 | 153 | ||
133 | protected virtual bool IsGridUser(LLUUID user) | 154 | protected bool IsGridUser(LLUUID user) |
134 | { | 155 | { |
135 | return true; | 156 | return true; |
136 | } | 157 | } |
137 | 158 | ||
138 | protected virtual bool IsGuest(LLUUID user) | 159 | protected bool IsGuest(LLUUID user) |
139 | { | 160 | { |
140 | return false; | 161 | return false; |
141 | } | 162 | } |
142 | 163 | ||
143 | public virtual bool CanRezObject(LLUUID user, LLVector3 position, int objectCount) | 164 | public bool CanRezObject(int objectCount, LLUUID user, LLVector3 position,Scene scene) |
144 | { | 165 | { |
145 | bool permission = false; | 166 | bool permission = false; |
146 | 167 | ||
@@ -148,13 +169,6 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
148 | 169 | ||
149 | string reason = "Insufficient permission"; | 170 | string reason = "Insufficient permission"; |
150 | 171 | ||
151 | //Perform ExternalChecks first! | ||
152 | bool results = m_scene.ExternalChecks.ExternalChecksCanRezObject(objectCount, user, position); | ||
153 | if (results == false) | ||
154 | { | ||
155 | return false; | ||
156 | } | ||
157 | |||
158 | ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y); | 172 | ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y); |
159 | if (land == null) return false; | 173 | if (land == null) return false; |
160 | 174 | ||
@@ -189,7 +203,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
189 | } | 203 | } |
190 | 204 | ||
191 | /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see> | 205 | /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see> |
192 | public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos) | 206 | public bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos) |
193 | { | 207 | { |
194 | if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f)) | 208 | if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f)) |
195 | { | 209 | { |
@@ -233,7 +247,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
233 | 247 | ||
234 | #region Object Permissions | 248 | #region Object Permissions |
235 | 249 | ||
236 | public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID) | 250 | public uint GenerateClientFlags(LLUUID user, LLUUID objID) |
237 | { | 251 | { |
238 | // Here's the way this works, | 252 | // Here's the way this works, |
239 | // ObjectFlags and Permission flags are two different enumerations | 253 | // ObjectFlags and Permission flags are two different enumerations |
@@ -344,7 +358,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
344 | return objectFlagsMask; | 358 | return objectFlagsMask; |
345 | } | 359 | } |
346 | 360 | ||
347 | protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId) | 361 | protected bool GenericObjectPermission(LLUUID currentUser, LLUUID objId) |
348 | { | 362 | { |
349 | // Default: deny | 363 | // Default: deny |
350 | bool permission = false; | 364 | bool permission = false; |
@@ -414,17 +428,17 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
414 | } | 428 | } |
415 | 429 | ||
416 | /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see> | 430 | /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see> |
417 | public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) | 431 | public bool CanDeRezObject(LLUUID obj,LLUUID user, Scene scene) |
418 | { | 432 | { |
419 | return GenericObjectPermission(user, obj); | 433 | return GenericObjectPermission(user, obj); |
420 | } | 434 | } |
421 | 435 | ||
422 | public virtual bool CanEditObject(LLUUID user, LLUUID obj) | 436 | public bool CanEditObject(LLUUID obj, LLUUID user, Scene scene) |
423 | { | 437 | { |
424 | return GenericObjectPermission(user, obj); | 438 | return GenericObjectPermission(user, obj); |
425 | } | 439 | } |
426 | 440 | ||
427 | public virtual bool CanEditObjectPosition(LLUUID user, LLUUID obj) | 441 | public bool CanEditObjectPosition(LLUUID obj, LLUUID user, Scene scene) |
428 | { | 442 | { |
429 | bool permission = GenericObjectPermission(user, obj); | 443 | bool permission = GenericObjectPermission(user, obj); |
430 | if (!permission) | 444 | if (!permission) |
@@ -499,7 +513,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
499 | return permission; | 513 | return permission; |
500 | } | 514 | } |
501 | 515 | ||
502 | public virtual bool CanCopyObject(LLUUID user, LLUUID obj) | 516 | public bool CanCopyObject(int objectCount, LLUUID obj, LLUUID user, Scene scene, LLVector3 objectPosition) |
503 | { | 517 | { |
504 | bool permission = GenericObjectPermission(user, obj); | 518 | bool permission = GenericObjectPermission(user, obj); |
505 | if (permission) | 519 | if (permission) |
@@ -521,15 +535,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
521 | // the administrator object permissions to take effect. | 535 | // the administrator object permissions to take effect. |
522 | LLUUID objectOwner = task.OwnerID; | 536 | LLUUID objectOwner = task.OwnerID; |
523 | 537 | ||
524 | //Check ExternalChecks! | 538 | |
525 | if (m_scene.ExternalChecks.ExternalChecksCanRezObject(task.Children.Count, objectOwner, task.GroupCentrePoint) == false) return false; | ||
526 | if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) | 539 | if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) |
527 | permission = true; | 540 | permission = true; |
528 | } | 541 | } |
529 | return permission; | 542 | return permission; |
530 | } | 543 | } |
531 | 544 | ||
532 | public virtual bool CanReturnObject(LLUUID user, LLUUID obj) | 545 | public bool CanReturnObject(LLUUID obj, LLUUID user, Scene scene) |
533 | { | 546 | { |
534 | return GenericObjectPermission(user, obj); | 547 | return GenericObjectPermission(user, obj); |
535 | } | 548 | } |
@@ -538,7 +551,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
538 | 551 | ||
539 | #region Communication Permissions | 552 | #region Communication Permissions |
540 | 553 | ||
541 | protected virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) | 554 | protected bool GenericCommunicationPermission(LLUUID user, LLUUID target) |
542 | { | 555 | { |
543 | bool permission = false; | 556 | bool permission = false; |
544 | string reason = "Only registered users may communicate with another account."; | 557 | string reason = "Only registered users may communicate with another account."; |
@@ -563,36 +576,34 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
563 | return permission; | 576 | return permission; |
564 | } | 577 | } |
565 | 578 | ||
566 | public virtual bool CanInstantMessage(LLUUID user, LLUUID target) | 579 | public bool CanInstantMessage(LLUUID user, LLUUID target, Scene scene) |
567 | { | 580 | { |
568 | return GenericCommunicationPermission(user, target); | 581 | return GenericCommunicationPermission(user, target); |
569 | } | 582 | } |
570 | 583 | ||
571 | public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target) | 584 | public bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene scene) |
572 | { | 585 | { |
573 | return GenericCommunicationPermission(user, target); | 586 | return GenericCommunicationPermission(user, target); |
574 | } | 587 | } |
575 | 588 | ||
576 | #endregion | 589 | #endregion |
577 | 590 | ||
578 | public virtual bool CanEditScript(LLUUID user, LLUUID script) | 591 | public bool CanEditScript(LLUUID script, LLUUID user, Scene scene) |
579 | { | 592 | { |
580 | return IsAdministrator(user); | 593 | return IsAdministrator(user); |
581 | } | 594 | } |
582 | 595 | ||
583 | public virtual bool CanRunScript(LLUUID user, LLUUID script) | 596 | public bool CanRunScript(LLUUID script, LLUUID user, Scene scene) |
584 | { | 597 | { |
585 | //External Checks! | ||
586 | if (!m_scene.ExternalChecks.ExternalChecksCanRunScript(script, user)) return false; | ||
587 | return IsAdministrator(user); | 598 | return IsAdministrator(user); |
588 | } | 599 | } |
589 | 600 | ||
590 | public virtual bool CanRunConsoleCommand(LLUUID user) | 601 | public bool CanRunConsoleCommand(LLUUID user, Scene scene) |
591 | { | 602 | { |
592 | return IsAdministrator(user); | 603 | return IsAdministrator(user); |
593 | } | 604 | } |
594 | 605 | ||
595 | public virtual bool CanTerraform(LLUUID user, LLVector3 position) | 606 | public bool CanTerraform(LLUUID user, LLVector3 position, Scene scene) |
596 | { | 607 | { |
597 | bool permission = false; | 608 | bool permission = false; |
598 | 609 | ||
@@ -625,7 +636,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
625 | 636 | ||
626 | #region Estate Permissions | 637 | #region Estate Permissions |
627 | 638 | ||
628 | public virtual bool GenericEstatePermission(LLUUID user) | 639 | public bool GenericEstatePermission(LLUUID user) |
629 | { | 640 | { |
630 | // Default: deny | 641 | // Default: deny |
631 | bool permission = false; | 642 | bool permission = false; |
@@ -641,12 +652,12 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
641 | return permission; | 652 | return permission; |
642 | } | 653 | } |
643 | 654 | ||
644 | public virtual bool CanEditEstateTerrain(LLUUID user) | 655 | public bool CanEditEstateTerrain(LLUUID user, Scene scene) |
645 | { | 656 | { |
646 | return GenericEstatePermission(user); | 657 | return GenericEstatePermission(user); |
647 | } | 658 | } |
648 | 659 | ||
649 | public virtual bool CanRestartSim(LLUUID user) | 660 | public bool CanRestartSim(LLUUID user, Scene scene) |
650 | { | 661 | { |
651 | // Since this is potentially going on a grid... | 662 | // Since this is potentially going on a grid... |
652 | 663 | ||
@@ -654,11 +665,16 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
654 | //return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; | 665 | //return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; |
655 | } | 666 | } |
656 | 667 | ||
668 | public bool CanBeGodLike(LLUUID user, Scene scene) | ||
669 | { | ||
670 | return GenericEstatePermission(user); | ||
671 | } | ||
672 | |||
657 | #endregion | 673 | #endregion |
658 | 674 | ||
659 | #region Parcel Permissions | 675 | #region Parcel Permissions |
660 | 676 | ||
661 | protected virtual bool GenericParcelPermission(LLUUID user, ILandObject parcel) | 677 | protected bool GenericParcelPermission(LLUUID user, ILandObject parcel) |
662 | { | 678 | { |
663 | bool permission = false; | 679 | bool permission = false; |
664 | 680 | ||
@@ -685,24 +701,24 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
685 | return permission; | 701 | return permission; |
686 | } | 702 | } |
687 | 703 | ||
688 | protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) | 704 | protected bool GenericParcelPermission(LLUUID user, LLVector3 pos) |
689 | { | 705 | { |
690 | ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 706 | ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
691 | if (parcel == null) return false; | 707 | if (parcel == null) return false; |
692 | return GenericParcelPermission(user, parcel); | 708 | return GenericParcelPermission(user, parcel); |
693 | } | 709 | } |
694 | 710 | ||
695 | public virtual bool CanEditParcel(LLUUID user, ILandObject parcel) | 711 | public bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene) |
696 | { | 712 | { |
697 | return GenericParcelPermission(user, parcel); | 713 | return GenericParcelPermission(user, parcel); |
698 | } | 714 | } |
699 | 715 | ||
700 | public virtual bool CanSellParcel(LLUUID user, ILandObject parcel) | 716 | public bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene) |
701 | { | 717 | { |
702 | return GenericParcelPermission(user, parcel); | 718 | return GenericParcelPermission(user, parcel); |
703 | } | 719 | } |
704 | 720 | ||
705 | public virtual bool CanAbandonParcel(LLUUID user, ILandObject parcel) | 721 | public bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene) |
706 | { | 722 | { |
707 | return GenericParcelPermission(user, parcel); | 723 | return GenericParcelPermission(user, parcel); |
708 | } | 724 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 91a28e4..4562fb6 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.Permissions.CanTerraform(remoteClient.AgentId, new LLVector3(north, west, 0))) | 452 | if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(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 7ffddb3..2c8c323 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -394,7 +394,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
394 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) | 394 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) |
395 | { | 395 | { |
396 | SceneObjectGroup group = (SceneObjectGroup)obj; | 396 | SceneObjectGroup group = (SceneObjectGroup)obj; |
397 | if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, obj.UUID)) | 397 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditScript(obj.UUID, remoteClient.AgentId)) |
398 | { | 398 | { |
399 | // If the attachment point isn't the same as the one previously used | 399 | // If the attachment point isn't the same as the one previously used |
400 | // set it's offset position = 0 so that it appears on the attachment point | 400 | // set it's offset position = 0 so that it appears on the attachment point |
@@ -1051,7 +1051,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1051 | SceneObjectGroup group = GetGroupByPrim(localID); | 1051 | SceneObjectGroup group = GetGroupByPrim(localID); |
1052 | if (group != null) | 1052 | if (group != null) |
1053 | { | 1053 | { |
1054 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1054 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) |
1055 | { | 1055 | { |
1056 | group.Resize(scale, localID); | 1056 | group.Resize(scale, localID); |
1057 | } | 1057 | } |
@@ -1062,7 +1062,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1062 | SceneObjectGroup group = GetGroupByPrim(localID); | 1062 | SceneObjectGroup group = GetGroupByPrim(localID); |
1063 | if (group != null) | 1063 | if (group != null) |
1064 | { | 1064 | { |
1065 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1065 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) |
1066 | { | 1066 | { |
1067 | group.GroupResize(scale, localID); | 1067 | group.GroupResize(scale, localID); |
1068 | } | 1068 | } |
@@ -1098,7 +1098,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1098 | SceneObjectGroup group = GetGroupByPrim(localID); | 1098 | SceneObjectGroup group = GetGroupByPrim(localID); |
1099 | if (group != null) | 1099 | if (group != null) |
1100 | { | 1100 | { |
1101 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1101 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId)) |
1102 | { | 1102 | { |
1103 | group.UpdateSingleRotation(rot, localID); | 1103 | group.UpdateSingleRotation(rot, localID); |
1104 | } | 1104 | } |
@@ -1116,7 +1116,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1116 | SceneObjectGroup group = GetGroupByPrim(localID); | 1116 | SceneObjectGroup group = GetGroupByPrim(localID); |
1117 | if (group != null) | 1117 | if (group != null) |
1118 | { | 1118 | { |
1119 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1119 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId)) |
1120 | { | 1120 | { |
1121 | group.UpdateGroupRotation(rot); | 1121 | group.UpdateGroupRotation(rot); |
1122 | } | 1122 | } |
@@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1135 | SceneObjectGroup group = GetGroupByPrim(localID); | 1135 | SceneObjectGroup group = GetGroupByPrim(localID); |
1136 | if (group != null) | 1136 | if (group != null) |
1137 | { | 1137 | { |
1138 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1138 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId)) |
1139 | { | 1139 | { |
1140 | group.UpdateGroupRotation(pos, rot); | 1140 | group.UpdateGroupRotation(pos, rot); |
1141 | } | 1141 | } |
@@ -1148,12 +1148,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1148 | if (group != null) | 1148 | if (group != null) |
1149 | { | 1149 | { |
1150 | LLVector3 oldPos = group.AbsolutePosition; | 1150 | LLVector3 oldPos = group.AbsolutePosition; |
1151 | if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) | 1151 | //FIXME: ObjectEntry is not in ExternalChecks! |
1152 | { | 1152 | //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) |
1153 | //{ | ||
1153 | group.SendGroupTerseUpdate(); | 1154 | group.SendGroupTerseUpdate(); |
1154 | return; | 1155 | //return; |
1155 | } | 1156 | //} |
1156 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) | 1157 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) |
1157 | { | 1158 | { |
1158 | group.UpdateSinglePosition(pos, localID); | 1159 | group.UpdateSinglePosition(pos, localID); |
1159 | } | 1160 | } |
@@ -1179,12 +1180,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1179 | } | 1180 | } |
1180 | else | 1181 | else |
1181 | { | 1182 | { |
1182 | if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) | 1183 | //FIXME: ObjectEntry not in ExternalChecks! |
1183 | { | 1184 | //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) |
1185 | //{ | ||
1184 | group.SendGroupTerseUpdate(); | 1186 | group.SendGroupTerseUpdate(); |
1185 | return; | 1187 | // return; |
1186 | } | 1188 | //} |
1187 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) | 1189 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment) |
1188 | { | 1190 | { |
1189 | group.UpdateGroupPosition(pos); | 1191 | group.UpdateGroupPosition(pos); |
1190 | } | 1192 | } |
@@ -1203,7 +1205,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1203 | SceneObjectGroup group = GetGroupByPrim(localID); | 1205 | SceneObjectGroup group = GetGroupByPrim(localID); |
1204 | if (group != null) | 1206 | if (group != null) |
1205 | { | 1207 | { |
1206 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1208 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID,remoteClient.AgentId)) |
1207 | { | 1209 | { |
1208 | group.UpdateTextureEntry(localID, texture); | 1210 | group.UpdateTextureEntry(localID, texture); |
1209 | } | 1211 | } |
@@ -1221,7 +1223,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1221 | SceneObjectGroup group = GetGroupByPrim(localID); | 1223 | SceneObjectGroup group = GetGroupByPrim(localID); |
1222 | if (group != null) | 1224 | if (group != null) |
1223 | { | 1225 | { |
1224 | if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID)) | 1226 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) |
1225 | { | 1227 | { |
1226 | group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); | 1228 | group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); |
1227 | } | 1229 | } |
@@ -1233,7 +1235,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1233 | SceneObjectGroup group = GetGroupByPrim(objectID); | 1235 | SceneObjectGroup group = GetGroupByPrim(objectID); |
1234 | if (group != null) | 1236 | if (group != null) |
1235 | { | 1237 | { |
1236 | if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.) | 1238 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) |
1237 | { | 1239 | { |
1238 | group.GrabMovement(offset, pos, remoteClient); | 1240 | group.GrabMovement(offset, pos, remoteClient); |
1239 | } | 1241 | } |
@@ -1255,7 +1257,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1255 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1257 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1256 | if (group != null) | 1258 | if (group != null) |
1257 | { | 1259 | { |
1258 | if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID)) | 1260 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) |
1259 | { | 1261 | { |
1260 | group.SetPartName(Util.CleanString(name), primLocalID); | 1262 | group.SetPartName(Util.CleanString(name), primLocalID); |
1261 | } | 1263 | } |
@@ -1272,7 +1274,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1272 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1274 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1273 | if (group != null) | 1275 | if (group != null) |
1274 | { | 1276 | { |
1275 | if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID)) | 1277 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) |
1276 | { | 1278 | { |
1277 | group.SetPartDescription(Util.CleanString(description), primLocalID); | 1279 | group.SetPartDescription(Util.CleanString(description), primLocalID); |
1278 | } | 1280 | } |
@@ -1285,7 +1287,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1285 | 1287 | ||
1286 | if (group != null) | 1288 | if (group != null) |
1287 | { | 1289 | { |
1288 | if (m_parentScene.Permissions.CanEditObject(agentID, group.UUID)) | 1290 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID,agentID)) |
1289 | { | 1291 | { |
1290 | group.UpdateExtraParam(primLocalID, type, inUse, data); | 1292 | group.UpdateExtraParam(primLocalID, type, inUse, data); |
1291 | } | 1293 | } |
@@ -1302,7 +1304,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1302 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1304 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1303 | if (group != null) | 1305 | if (group != null) |
1304 | { | 1306 | { |
1305 | if (m_parentScene.Permissions.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID))) | 1307 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.GetPartsFullID(primLocalID), agentID)) |
1306 | { | 1308 | { |
1307 | ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); | 1309 | ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); |
1308 | shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; | 1310 | shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; |
@@ -1489,11 +1491,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1489 | // * Asset/DRM permission bit "modify" is enabled | 1491 | // * Asset/DRM permission bit "modify" is enabled |
1490 | //use CanEditObjectPosition | 1492 | //use CanEditObjectPosition |
1491 | 1493 | ||
1492 | if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(user, objid)) | 1494 | if (IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanEditObject(objid, user)) |
1493 | { | 1495 | { |
1494 | obj.AddFlag(LLObject.ObjectFlags.JointWheel); | 1496 | obj.AddFlag(LLObject.ObjectFlags.JointWheel); |
1495 | } | 1497 | } |
1496 | else if (!IncludeInSearch && m_parentScene.Permissions.CanEditObjectPosition(user, objid)) | 1498 | else if (!IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(objid,user)) |
1497 | { | 1499 | { |
1498 | obj.RemFlag(LLObject.ObjectFlags.JointWheel); | 1500 | obj.RemFlag(LLObject.ObjectFlags.JointWheel); |
1499 | } | 1501 | } |
@@ -1526,7 +1528,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1526 | 1528 | ||
1527 | if (originPrim != null) | 1529 | if (originPrim != null) |
1528 | { | 1530 | { |
1529 | if (m_parentScene.Permissions.CanCopyObject(AgentID, originPrim.UUID)) | 1531 | if (m_parentScene.ExternalChecks.ExternalChecksCanCopyObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition)) |
1530 | { | 1532 | { |
1531 | SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); | 1533 | SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); |
1532 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 1534 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index b536048..e78ad2b 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 (Permissions.IsEstateManager(remoteClient.AgentId)) | 76 | if (ExternalChecks.ExternalChecksCanBeGodLike(remoteClient.AgentId)) |
77 | { | 77 | { |
78 | userlevel = 1; | 78 | userlevel = 1; |
79 | } | 79 | } |
@@ -988,13 +988,11 @@ 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 = Permissions.CanCopyObject(remoteClient.AgentId, | 991 | permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); |
992 | ((SceneObjectGroup) selectedEnt).UUID); | ||
993 | } | 992 | } |
994 | else | 993 | else |
995 | { // Take | 994 | { // Take |
996 | permission = Permissions.CanDeRezObject(remoteClient.AgentId, | 995 | permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); |
997 | ((SceneObjectGroup) selectedEnt).UUID); | ||
998 | } | 996 | } |
999 | 997 | ||
1000 | if (permission) | 998 | if (permission) |
@@ -1285,7 +1283,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1285 | { | 1283 | { |
1286 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); | 1284 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); |
1287 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 1285 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
1288 | if (!Permissions.CanRezObject(remoteClient.AgentId, pos, group.Children.Count) && !attachment) | 1286 | if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count,remoteClient.AgentId, pos) && !attachment) |
1289 | { | 1287 | { |
1290 | return null; | 1288 | return null; |
1291 | } | 1289 | } |
@@ -1371,7 +1369,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1371 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); | 1369 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); |
1372 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 1370 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
1373 | 1371 | ||
1374 | if (!Permissions.CanRezObject(ownerID, pos, group.Children.Count)) | 1372 | if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count, ownerID, pos)) |
1375 | { | 1373 | { |
1376 | return null; | 1374 | return null; |
1377 | } | 1375 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index fb043b7..f55d822 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 (Permissions.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || Permissions.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID)) | 88 | if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) |
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 (Permissions.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || Permissions.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID)) | 115 | if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) |
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 ebbfece..5ce3c7b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1245,7 +1245,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1245 | 1245 | ||
1246 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false); | 1246 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false); |
1247 | 1247 | ||
1248 | if (Permissions.CanRezObject(ownerID, pos, 1)) | 1248 | if ( ExternalChecks.ExternalChecksCanRezObject(1,ownerID,pos)) |
1249 | { | 1249 | { |
1250 | // rez ON the ground, not IN the ground | 1250 | // rez ON the ground, not IN the ground |
1251 | pos.Z += 0.25F; | 1251 | pos.Z += 0.25F; |
@@ -2519,7 +2519,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2519 | if (m_scenePresences.ContainsKey(agentID)) | 2519 | if (m_scenePresences.ContainsKey(agentID)) |
2520 | { | 2520 | { |
2521 | // First check that this is the sim owner | 2521 | // First check that this is the sim owner |
2522 | if (Permissions.GenericEstatePermission(agentID)) | 2522 | if (ExternalChecks.ExternalChecksCanBeGodLike(agentID)) |
2523 | { | 2523 | { |
2524 | // Next we check for spoofing..... | 2524 | // Next we check for spoofing..... |
2525 | LLUUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; | 2525 | LLUUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; |
@@ -2597,7 +2597,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2597 | { | 2597 | { |
2598 | if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) | 2598 | if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) |
2599 | { | 2599 | { |
2600 | if (Permissions.GenericEstatePermission(godID)) | 2600 | if (ExternalChecks.ExternalChecksCanBeGodLike(godID)) |
2601 | { | 2601 | { |
2602 | if (agentID == kickUserID) | 2602 | if (agentID == kickUserID) |
2603 | { | 2603 | { |
@@ -2918,7 +2918,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2918 | } | 2918 | } |
2919 | else if ((parcel.landData.landFlags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0) | 2919 | else if ((parcel.landData.landFlags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0) |
2920 | { | 2920 | { |
2921 | if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || Permissions.GenericEstatePermission(part.OwnerID)) | 2921 | if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || ExternalChecks.ExternalChecksCanBeGodLike(part.OwnerID)) |
2922 | { | 2922 | { |
2923 | return true; | 2923 | return true; |
2924 | } | 2924 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index 2d3e8e4..4e579b6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Text; | 30 | using System.Text; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Environment.Interfaces; | ||
33 | 34 | ||
34 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace OpenSim.Region.Environment.Scenes |
35 | { | 36 | { |
@@ -42,63 +43,563 @@ namespace OpenSim.Region.Environment.Scenes | |||
42 | m_scene = scene; | 43 | m_scene = scene; |
43 | } | 44 | } |
44 | 45 | ||
45 | #region REZ OBJECT | 46 | #region Object Permission Checks |
46 | public delegate bool CanRezObject(int objectCount, LLUUID owner, IScene scene, LLVector3 objectPosition); | ||
47 | private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>(); | ||
48 | 47 | ||
49 | public void addCheckRezObject(CanRezObject delegateFunc) | 48 | #region REZ OBJECT |
50 | { | 49 | public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene); |
51 | if(!CanRezObjectCheckFunctions.Contains(delegateFunc)) | 50 | private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>(); |
52 | CanRezObjectCheckFunctions.Add(delegateFunc); | ||
53 | } | ||
54 | public void removeCheckRezObject(CanRezObject delegateFunc) | ||
55 | { | ||
56 | if (CanRezObjectCheckFunctions.Contains(delegateFunc)) | ||
57 | CanRezObjectCheckFunctions.Remove(delegateFunc); | ||
58 | } | ||
59 | 51 | ||
60 | public bool ExternalChecksCanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition) | 52 | public void addCheckRezObject(CanRezObject delegateFunc) |
61 | { | 53 | { |
62 | foreach (CanRezObject check in CanRezObjectCheckFunctions) | 54 | if(!CanRezObjectCheckFunctions.Contains(delegateFunc)) |
55 | CanRezObjectCheckFunctions.Add(delegateFunc); | ||
56 | } | ||
57 | public void removeCheckRezObject(CanRezObject delegateFunc) | ||
58 | { | ||
59 | if (CanRezObjectCheckFunctions.Contains(delegateFunc)) | ||
60 | CanRezObjectCheckFunctions.Remove(delegateFunc); | ||
61 | } | ||
62 | |||
63 | public bool ExternalChecksCanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition) | ||
63 | { | 64 | { |
64 | if (check(objectCount, owner, m_scene, objectPosition) == false) | 65 | foreach (CanRezObject check in CanRezObjectCheckFunctions) |
65 | { | 66 | { |
66 | return false; | 67 | if (check(objectCount, owner,objectPosition, m_scene) == false) |
68 | { | ||
69 | return false; | ||
70 | } | ||
67 | } | 71 | } |
72 | return true; | ||
68 | } | 73 | } |
69 | return true; | 74 | |
70 | } | 75 | #endregion |
76 | |||
77 | #region DEREZ OBJECT | ||
78 | public delegate bool CanDeRezObject(LLUUID objectID, LLUUID deleter, Scene scene); | ||
79 | private List<CanDeRezObject> CanDeRezObjectCheckFunctions = new List<CanDeRezObject>(); | ||
80 | |||
81 | public void addCheckDeRezObject(CanDeRezObject delegateFunc) | ||
82 | { | ||
83 | if (!CanDeRezObjectCheckFunctions.Contains(delegateFunc)) | ||
84 | CanDeRezObjectCheckFunctions.Add(delegateFunc); | ||
85 | } | ||
86 | public void removeCheckDeRezObject(CanDeRezObject delegateFunc) | ||
87 | { | ||
88 | if (CanDeRezObjectCheckFunctions.Contains(delegateFunc)) | ||
89 | CanDeRezObjectCheckFunctions.Remove(delegateFunc); | ||
90 | } | ||
91 | |||
92 | public bool ExternalChecksCanDeRezObject(LLUUID objectID, LLUUID deleter) | ||
93 | { | ||
94 | foreach (CanDeRezObject check in CanDeRezObjectCheckFunctions) | ||
95 | { | ||
96 | if (check(objectID,deleter,m_scene) == false) | ||
97 | { | ||
98 | return false; | ||
99 | } | ||
100 | } | ||
101 | return true; | ||
102 | } | ||
103 | |||
104 | #endregion | ||
105 | |||
106 | #region TAKE OBJECT | ||
107 | public delegate bool CanTakeObject(LLUUID objectID, LLUUID stealer, Scene scene); | ||
108 | private List<CanTakeObject> CanTakeObjectCheckFunctions = new List<CanTakeObject>(); | ||
109 | |||
110 | public void addCheckTakeObject(CanTakeObject delegateFunc) | ||
111 | { | ||
112 | if (!CanTakeObjectCheckFunctions.Contains(delegateFunc)) | ||
113 | CanTakeObjectCheckFunctions.Add(delegateFunc); | ||
114 | } | ||
115 | public void removeCheckTakeObject(CanTakeObject delegateFunc) | ||
116 | { | ||
117 | if (CanTakeObjectCheckFunctions.Contains(delegateFunc)) | ||
118 | CanTakeObjectCheckFunctions.Remove(delegateFunc); | ||
119 | } | ||
120 | |||
121 | public bool ExternalChecksCanTakeObject(LLUUID objectID, LLUUID stealer) | ||
122 | { | ||
123 | foreach (CanTakeObject check in CanTakeObjectCheckFunctions) | ||
124 | { | ||
125 | if (check(objectID, stealer, m_scene) == false) | ||
126 | { | ||
127 | return false; | ||
128 | } | ||
129 | } | ||
130 | return true; | ||
131 | } | ||
132 | |||
133 | #endregion | ||
134 | |||
135 | #region COPY OBJECT | ||
136 | public delegate bool CanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition); | ||
137 | private List<CanCopyObject> CanCopyObjectCheckFunctions = new List<CanCopyObject>(); | ||
138 | |||
139 | public void addCheckCopyObject(CanCopyObject delegateFunc) | ||
140 | { | ||
141 | if (!CanCopyObjectCheckFunctions.Contains(delegateFunc)) | ||
142 | CanCopyObjectCheckFunctions.Add(delegateFunc); | ||
143 | } | ||
144 | public void removeCheckCopyObject(CanCopyObject delegateFunc) | ||
145 | { | ||
146 | if (CanCopyObjectCheckFunctions.Contains(delegateFunc)) | ||
147 | CanCopyObjectCheckFunctions.Remove(delegateFunc); | ||
148 | } | ||
149 | |||
150 | public bool ExternalChecksCanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition) | ||
151 | { | ||
152 | foreach (CanCopyObject check in CanCopyObjectCheckFunctions) | ||
153 | { | ||
154 | if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) | ||
155 | { | ||
156 | return false; | ||
157 | } | ||
158 | } | ||
159 | return true; | ||
160 | } | ||
161 | |||
162 | #endregion | ||
163 | |||
164 | #region EDIT OBJECT | ||
165 | public delegate bool CanEditObject(LLUUID objectID, LLUUID editorID, Scene scene); | ||
166 | private List<CanEditObject> CanEditObjectCheckFunctions = new List<CanEditObject>(); | ||
167 | |||
168 | public void addCheckEditObject(CanEditObject delegateFunc) | ||
169 | { | ||
170 | if (!CanEditObjectCheckFunctions.Contains(delegateFunc)) | ||
171 | CanEditObjectCheckFunctions.Add(delegateFunc); | ||
172 | } | ||
173 | public void removeCheckEditObject(CanEditObject delegateFunc) | ||
174 | { | ||
175 | if (CanEditObjectCheckFunctions.Contains(delegateFunc)) | ||
176 | CanEditObjectCheckFunctions.Remove(delegateFunc); | ||
177 | } | ||
178 | |||
179 | public bool ExternalChecksCanEditObject(LLUUID objectID, LLUUID editorID) | ||
180 | { | ||
181 | foreach (CanEditObject check in CanEditObjectCheckFunctions) | ||
182 | { | ||
183 | if (check(objectID, editorID, m_scene) == false) | ||
184 | { | ||
185 | return false; | ||
186 | } | ||
187 | } | ||
188 | return true; | ||
189 | } | ||
190 | |||
191 | #endregion | ||
192 | |||
193 | #region MOVE OBJECT | ||
194 | public delegate bool CanMoveObject(LLUUID objectID, LLUUID moverID, Scene scene); | ||
195 | private List<CanMoveObject> CanMoveObjectCheckFunctions = new List<CanMoveObject>(); | ||
196 | |||
197 | public void addCheckMoveObject(CanMoveObject delegateFunc) | ||
198 | { | ||
199 | if (!CanMoveObjectCheckFunctions.Contains(delegateFunc)) | ||
200 | CanMoveObjectCheckFunctions.Add(delegateFunc); | ||
201 | } | ||
202 | public void removeCheckMoveObject(CanMoveObject delegateFunc) | ||
203 | { | ||
204 | if (CanMoveObjectCheckFunctions.Contains(delegateFunc)) | ||
205 | CanMoveObjectCheckFunctions.Remove(delegateFunc); | ||
206 | } | ||
207 | |||
208 | public bool ExternalChecksCanMoveObject(LLUUID objectID, LLUUID moverID) | ||
209 | { | ||
210 | foreach (CanMoveObject check in CanMoveObjectCheckFunctions) | ||
211 | { | ||
212 | if (check(objectID,moverID,m_scene) == false) | ||
213 | { | ||
214 | return false; | ||
215 | } | ||
216 | } | ||
217 | return true; | ||
218 | } | ||
219 | |||
220 | #endregion | ||
221 | |||
222 | #region RETURN OBJECT | ||
223 | public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene); | ||
224 | private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>(); | ||
225 | |||
226 | public void addCheckReturnObject(CanReturnObject delegateFunc) | ||
227 | { | ||
228 | if (!CanReturnObjectCheckFunctions.Contains(delegateFunc)) | ||
229 | CanReturnObjectCheckFunctions.Add(delegateFunc); | ||
230 | } | ||
231 | public void removeCheckReturnObject(CanReturnObject delegateFunc) | ||
232 | { | ||
233 | if (CanReturnObjectCheckFunctions.Contains(delegateFunc)) | ||
234 | CanReturnObjectCheckFunctions.Remove(delegateFunc); | ||
235 | } | ||
236 | |||
237 | public bool ExternalChecksCanReturnObject(LLUUID objectID, LLUUID returnerID) | ||
238 | { | ||
239 | foreach (CanReturnObject check in CanReturnObjectCheckFunctions) | ||
240 | { | ||
241 | if (check(objectID,returnerID,m_scene) == false) | ||
242 | { | ||
243 | return false; | ||
244 | } | ||
245 | } | ||
246 | return true; | ||
247 | } | ||
248 | |||
249 | #endregion | ||
71 | 250 | ||
72 | #endregion | 251 | #endregion |
73 | 252 | ||
74 | #region RUN SCRIPT | 253 | #region Misc Permission Checks |
75 | public delegate bool CanRunScript(LLUUID script, LLUUID owner, IScene scene); | ||
76 | private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>(); | ||
77 | 254 | ||
78 | public void addCheckRunScript(CanRunScript delegateFunc) | 255 | #region INSTANT MESSAGE |
79 | { | 256 | public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene); |
80 | if (!CanRunScriptCheckFunctions.Contains(delegateFunc)) | 257 | private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>(); |
81 | CanRunScriptCheckFunctions.Add(delegateFunc); | ||
82 | } | ||
83 | public void removeCheckRunScript(CanRunScript delegateFunc) | ||
84 | { | ||
85 | if (CanRunScriptCheckFunctions.Contains(delegateFunc)) | ||
86 | CanRunScriptCheckFunctions.Remove(delegateFunc); | ||
87 | } | ||
88 | 258 | ||
89 | public bool ExternalChecksCanRunScript(LLUUID script, LLUUID owner) | 259 | public void addCheckInstantMessage(CanInstantMessage delegateFunc) |
90 | { | 260 | { |
91 | foreach (CanRunScript check in CanRunScriptCheckFunctions) | 261 | if (!CanInstantMessageCheckFunctions.Contains(delegateFunc)) |
262 | CanInstantMessageCheckFunctions.Add(delegateFunc); | ||
263 | } | ||
264 | public void removeCheckInstantMessage(CanInstantMessage delegateFunc) | ||
265 | { | ||
266 | if (CanInstantMessageCheckFunctions.Contains(delegateFunc)) | ||
267 | CanInstantMessageCheckFunctions.Remove(delegateFunc); | ||
268 | } | ||
269 | |||
270 | public bool ExternalChecksCanInstantMessage(LLUUID user, LLUUID target) | ||
92 | { | 271 | { |
93 | if (check(script,owner,m_scene) == false) | 272 | foreach (CanInstantMessage check in CanInstantMessageCheckFunctions) |
94 | { | 273 | { |
95 | return false; | 274 | if (check(user,target,m_scene) == false) |
275 | { | ||
276 | return false; | ||
277 | } | ||
96 | } | 278 | } |
279 | return true; | ||
97 | } | 280 | } |
98 | return true; | 281 | |
99 | } | 282 | #endregion |
283 | |||
284 | #region INVENTORY TRANSFER | ||
285 | public delegate bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene startScene); | ||
286 | private List<CanInventoryTransfer> CanInventoryTransferCheckFunctions = new List<CanInventoryTransfer>(); | ||
287 | |||
288 | public void addCheckInventoryTransfer(CanInventoryTransfer delegateFunc) | ||
289 | { | ||
290 | if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc)) | ||
291 | CanInventoryTransferCheckFunctions.Add(delegateFunc); | ||
292 | } | ||
293 | public void removeCheckInventoryTransfer(CanInventoryTransfer delegateFunc) | ||
294 | { | ||
295 | if (CanInventoryTransferCheckFunctions.Contains(delegateFunc)) | ||
296 | CanInventoryTransferCheckFunctions.Remove(delegateFunc); | ||
297 | } | ||
298 | |||
299 | public bool ExternalChecksCanInventoryTransfer(LLUUID user, LLUUID target) | ||
300 | { | ||
301 | foreach (CanInventoryTransfer check in CanInventoryTransferCheckFunctions) | ||
302 | { | ||
303 | if (check(user, target, m_scene) == false) | ||
304 | { | ||
305 | return false; | ||
306 | } | ||
307 | } | ||
308 | return true; | ||
309 | } | ||
310 | |||
311 | #endregion | ||
312 | |||
313 | #region EDIT SCRIPT | ||
314 | public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene); | ||
315 | private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>(); | ||
316 | |||
317 | public void addCheckEditScript(CanEditScript delegateFunc) | ||
318 | { | ||
319 | if (!CanEditScriptCheckFunctions.Contains(delegateFunc)) | ||
320 | CanEditScriptCheckFunctions.Add(delegateFunc); | ||
321 | } | ||
322 | public void removeCheckEditScript(CanEditScript delegateFunc) | ||
323 | { | ||
324 | if (CanEditScriptCheckFunctions.Contains(delegateFunc)) | ||
325 | CanEditScriptCheckFunctions.Remove(delegateFunc); | ||
326 | } | ||
327 | |||
328 | public bool ExternalChecksCanEditScript(LLUUID script, LLUUID user) | ||
329 | { | ||
330 | foreach (CanEditScript check in CanEditScriptCheckFunctions) | ||
331 | { | ||
332 | if (check(script, user, m_scene) == false) | ||
333 | { | ||
334 | return false; | ||
335 | } | ||
336 | } | ||
337 | return true; | ||
338 | } | ||
339 | |||
340 | #endregion | ||
341 | |||
342 | #region RUN SCRIPT | ||
343 | public delegate bool CanRunScript(LLUUID script, LLUUID user, Scene scene); | ||
344 | private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>(); | ||
345 | |||
346 | public void addCheckRunScript(CanRunScript delegateFunc) | ||
347 | { | ||
348 | if (!CanRunScriptCheckFunctions.Contains(delegateFunc)) | ||
349 | CanRunScriptCheckFunctions.Add(delegateFunc); | ||
350 | } | ||
351 | public void removeCheckRunScript(CanRunScript delegateFunc) | ||
352 | { | ||
353 | if (CanRunScriptCheckFunctions.Contains(delegateFunc)) | ||
354 | CanRunScriptCheckFunctions.Remove(delegateFunc); | ||
355 | } | ||
356 | |||
357 | public bool ExternalChecksCanRunScript(LLUUID script, LLUUID user) | ||
358 | { | ||
359 | foreach (CanRunScript check in CanRunScriptCheckFunctions) | ||
360 | { | ||
361 | if (check(script, user, m_scene) == false) | ||
362 | { | ||
363 | return false; | ||
364 | } | ||
365 | } | ||
366 | return true; | ||
367 | } | ||
368 | |||
369 | #endregion | ||
370 | |||
371 | #region TERRAFORM LAND | ||
372 | public delegate bool CanTerraformLandCommand(LLUUID user, LLVector3 position, Scene requestFromScene); | ||
373 | private List<CanTerraformLandCommand> CanTerraformLandCommandCheckFunctions = new List<CanTerraformLandCommand>(); | ||
374 | |||
375 | public void addCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) | ||
376 | { | ||
377 | if (!CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) | ||
378 | CanTerraformLandCommandCheckFunctions.Add(delegateFunc); | ||
379 | } | ||
380 | public void removeCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) | ||
381 | { | ||
382 | if (CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) | ||
383 | CanTerraformLandCommandCheckFunctions.Remove(delegateFunc); | ||
384 | } | ||
385 | |||
386 | public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos) | ||
387 | { | ||
388 | foreach (CanTerraformLandCommand check in CanTerraformLandCommandCheckFunctions) | ||
389 | { | ||
390 | if (check(user, pos, m_scene) == false) | ||
391 | { | ||
392 | return false; | ||
393 | } | ||
394 | } | ||
395 | return true; | ||
396 | } | ||
397 | |||
398 | #endregion | ||
399 | |||
400 | #region RUN CONSOLE COMMAND | ||
401 | public delegate bool CanRunConsoleCommand(LLUUID user, Scene requestFromScene); | ||
402 | private List<CanRunConsoleCommand> CanRunConsoleCommandCheckFunctions = new List<CanRunConsoleCommand>(); | ||
403 | |||
404 | public void addCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc) | ||
405 | { | ||
406 | if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc)) | ||
407 | CanRunConsoleCommandCheckFunctions.Add(delegateFunc); | ||
408 | } | ||
409 | public void removeCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc) | ||
410 | { | ||
411 | if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc)) | ||
412 | CanRunConsoleCommandCheckFunctions.Remove(delegateFunc); | ||
413 | } | ||
414 | |||
415 | public bool ExternalChecksCanRunConsoleCommand(LLUUID user) | ||
416 | { | ||
417 | foreach (CanRunConsoleCommand check in CanRunConsoleCommandCheckFunctions) | ||
418 | { | ||
419 | if (check(user, m_scene) == false) | ||
420 | { | ||
421 | return false; | ||
422 | } | ||
423 | } | ||
424 | return true; | ||
425 | } | ||
426 | |||
427 | #endregion | ||
428 | |||
429 | #region CAN BE GODLIKE | ||
430 | public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene); | ||
431 | private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>(); | ||
432 | |||
433 | public void addCheckBeGodLike(CanBeGodLike delegateFunc) | ||
434 | { | ||
435 | if (!CanBeGodLikeCheckFunctions.Contains(delegateFunc)) | ||
436 | CanBeGodLikeCheckFunctions.Add(delegateFunc); | ||
437 | } | ||
438 | public void removeCheckBeGodLike(CanBeGodLike delegateFunc) | ||
439 | { | ||
440 | if (CanBeGodLikeCheckFunctions.Contains(delegateFunc)) | ||
441 | CanBeGodLikeCheckFunctions.Remove(delegateFunc); | ||
442 | } | ||
443 | |||
444 | public bool ExternalChecksCanBeGodLike(LLUUID user) | ||
445 | { | ||
446 | foreach (CanBeGodLike check in CanBeGodLikeCheckFunctions) | ||
447 | { | ||
448 | if (check(user, m_scene) == false) | ||
449 | { | ||
450 | return false; | ||
451 | } | ||
452 | } | ||
453 | return true; | ||
454 | } | ||
455 | |||
456 | #endregion | ||
100 | 457 | ||
101 | #endregion | 458 | #endregion |
102 | 459 | ||
460 | #region Parcel and Estate Permission Checks | ||
461 | #region EDIT ESTATE TERRAIN | ||
462 | public delegate bool CanEditEstateTerrain(LLUUID user, Scene scene); | ||
463 | private List<CanEditEstateTerrain> CanEditEstateTerrainCheckFunctions = new List<CanEditEstateTerrain>(); | ||
464 | |||
465 | public void addCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc) | ||
466 | { | ||
467 | if (!CanEditEstateTerrainCheckFunctions.Contains(delegateFunc)) | ||
468 | CanEditEstateTerrainCheckFunctions.Add(delegateFunc); | ||
469 | } | ||
470 | public void removeCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc) | ||
471 | { | ||
472 | if (CanEditEstateTerrainCheckFunctions.Contains(delegateFunc)) | ||
473 | CanEditEstateTerrainCheckFunctions.Remove(delegateFunc); | ||
474 | } | ||
475 | |||
476 | public bool ExternalChecksCanEditEstateTerrain(LLUUID user) | ||
477 | { | ||
478 | foreach (CanEditEstateTerrain check in CanEditEstateTerrainCheckFunctions) | ||
479 | { | ||
480 | if (check(user, m_scene) == false) | ||
481 | { | ||
482 | return false; | ||
483 | } | ||
484 | } | ||
485 | return true; | ||
486 | } | ||
487 | |||
488 | #endregion | ||
489 | |||
490 | #region RESTART SIM | ||
491 | public delegate bool CanRestartSim(LLUUID user, Scene scene); | ||
492 | private List<CanRestartSim> CanRestartSimCheckFunctions = new List<CanRestartSim>(); | ||
493 | |||
494 | public void addCheckRestartSim(CanRestartSim delegateFunc) | ||
495 | { | ||
496 | if (!CanRestartSimCheckFunctions.Contains(delegateFunc)) | ||
497 | CanRestartSimCheckFunctions.Add(delegateFunc); | ||
498 | } | ||
499 | public void removeCheckRestartSim(CanRestartSim delegateFunc) | ||
500 | { | ||
501 | if (CanRestartSimCheckFunctions.Contains(delegateFunc)) | ||
502 | CanRestartSimCheckFunctions.Remove(delegateFunc); | ||
503 | } | ||
504 | |||
505 | public bool ExternalChecksCanRestartSim(LLUUID user) | ||
506 | { | ||
507 | foreach (CanRestartSim check in CanRestartSimCheckFunctions) | ||
508 | { | ||
509 | if (check(user, m_scene) == false) | ||
510 | { | ||
511 | return false; | ||
512 | } | ||
513 | } | ||
514 | return true; | ||
515 | } | ||
516 | #endregion | ||
517 | |||
518 | #region EDIT PARCEL | ||
519 | public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene); | ||
520 | private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>(); | ||
521 | |||
522 | public void addCheckEditParcel(CanEditParcel delegateFunc) | ||
523 | { | ||
524 | if (!CanEditParcelCheckFunctions.Contains(delegateFunc)) | ||
525 | CanEditParcelCheckFunctions.Add(delegateFunc); | ||
526 | } | ||
527 | public void removeCheckEditParcel(CanEditParcel delegateFunc) | ||
528 | { | ||
529 | if (CanEditParcelCheckFunctions.Contains(delegateFunc)) | ||
530 | CanEditParcelCheckFunctions.Remove(delegateFunc); | ||
531 | } | ||
532 | |||
533 | public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel) | ||
534 | { | ||
535 | foreach (CanEditParcel check in CanEditParcelCheckFunctions) | ||
536 | { | ||
537 | if (check(user, parcel, m_scene) == false) | ||
538 | { | ||
539 | return false; | ||
540 | } | ||
541 | } | ||
542 | return true; | ||
543 | } | ||
544 | #endregion | ||
545 | |||
546 | #region SELL PARCEL | ||
547 | public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene); | ||
548 | private List<CanSellParcel> CanSellParcelCheckFunctions = new List<CanSellParcel>(); | ||
549 | |||
550 | public void addCheckSellParcel(CanSellParcel delegateFunc) | ||
551 | { | ||
552 | if (!CanSellParcelCheckFunctions.Contains(delegateFunc)) | ||
553 | CanSellParcelCheckFunctions.Add(delegateFunc); | ||
554 | } | ||
555 | public void removeCheckSellParcel(CanSellParcel delegateFunc) | ||
556 | { | ||
557 | if (CanSellParcelCheckFunctions.Contains(delegateFunc)) | ||
558 | CanSellParcelCheckFunctions.Remove(delegateFunc); | ||
559 | } | ||
560 | |||
561 | public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel) | ||
562 | { | ||
563 | foreach (CanSellParcel check in CanSellParcelCheckFunctions) | ||
564 | { | ||
565 | if (check(user, parcel, m_scene) == false) | ||
566 | { | ||
567 | return false; | ||
568 | } | ||
569 | } | ||
570 | return true; | ||
571 | } | ||
572 | #endregion | ||
573 | |||
574 | #region ABANDON PARCEL | ||
575 | public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene); | ||
576 | private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>(); | ||
577 | |||
578 | public void addCheckAbandonParcel(CanAbandonParcel delegateFunc) | ||
579 | { | ||
580 | if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) | ||
581 | CanAbandonParcelCheckFunctions.Add(delegateFunc); | ||
582 | } | ||
583 | public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc) | ||
584 | { | ||
585 | if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) | ||
586 | CanAbandonParcelCheckFunctions.Remove(delegateFunc); | ||
587 | } | ||
588 | |||
589 | public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel) | ||
590 | { | ||
591 | foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) | ||
592 | { | ||
593 | if (check(user, parcel, m_scene) == false) | ||
594 | { | ||
595 | return false; | ||
596 | } | ||
597 | } | ||
598 | return true; | ||
599 | } | ||
600 | #endregion | ||
601 | #endregion | ||
602 | |||
603 | |||
103 | } | 604 | } |
104 | } | 605 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index e3bec9d..48b356a 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -181,7 +181,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
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.Permissions.GenericEstatePermission( | 183 | //World.Permissions.GenericEstatePermission( |
184 | if (World.Permissions.GenericEstatePermission(m_host.OwnerID)) | 184 | if (World.ExternalChecks.ExternalChecksCanBeGodLike(m_host.OwnerID)) |
185 | { | 185 | { |
186 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); | 186 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); |
187 | } | 187 | } |
@@ -2647,7 +2647,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2647 | public void llModifyLand(int action, int brush) | 2647 | public void llModifyLand(int action, int brush) |
2648 | { | 2648 | { |
2649 | m_host.AddScriptLPS(1); | 2649 | m_host.AddScriptLPS(1); |
2650 | if (World.Permissions.CanTerraform(m_host.OwnerID, new LLVector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0))) | 2650 | if (World.ExternalChecks.ExternalChecksCanTerraformLand(m_host.OwnerID, new LLVector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0))) |
2651 | { | 2651 | { |
2652 | NotImplemented("llModifyLand"); | 2652 | NotImplemented("llModifyLand"); |
2653 | } | 2653 | } |
@@ -3900,7 +3900,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3900 | { | 3900 | { |
3901 | if (m_host.ObjectOwner == parcel.landData.ownerID || | 3901 | if (m_host.ObjectOwner == parcel.landData.ownerID || |
3902 | (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.groupID | 3902 | (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.groupID |
3903 | && parcel.landData.isGroupOwned) || World.Permissions.GenericEstatePermission(m_host.OwnerID)) | 3903 | && parcel.landData.isGroupOwned) || World.ExternalChecks.ExternalChecksCanBeGodLike(m_host.OwnerID)) |
3904 | { | 3904 | { |
3905 | av.StandUp(); | 3905 | av.StandUp(); |
3906 | } | 3906 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs index ddca617..401042a 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.Permissions.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0))) | 261 | if (World.ExternalChecks.ExternalChecksCanTerraformLand(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.Permissions.CanRestartSim(m_host.OwnerID)) | 284 | if (World.ExternalChecks.ExternalChecksCanRestartSim(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.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 409 | if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID)) |
410 | { | 410 | { |
411 | MainConsole.Instance.RunCommand(command); | 411 | MainConsole.Instance.RunCommand(command); |
412 | return true; | 412 | return true; |