diff options
author | mingchen | 2008-05-13 16:22:57 +0000 |
---|---|---|
committer | mingchen | 2008-05-13 16:22:57 +0000 |
commit | 32785921d0a4a074b92da0f4ec322cf451a4642f (patch) | |
tree | ae93cc8fb09a5d7b991e323617e3324042e30a8d /OpenSim/Region/Environment/Scenes | |
parent | * Remove old historical grid inventory code (diff) | |
download | opensim-SC_OLD-32785921d0a4a074b92da0f4ec322cf451a4642f.zip opensim-SC_OLD-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.gz opensim-SC_OLD-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.bz2 opensim-SC_OLD-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.xz |
*Complete redo of the permissions module
*Removed hardcoded permissions checks
*Added permissions checks where needed
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 29 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | 378 |
4 files changed, 260 insertions, 190 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 9dba398..8b9b888 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -288,8 +288,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
288 | { | 288 | { |
289 | if (((SceneObjectGroup)obj).LocalId == localID) | 289 | if (((SceneObjectGroup)obj).LocalId == localID) |
290 | { | 290 | { |
291 | m_parentScene.RemoveEntity((SceneObjectGroup)obj); | 291 | if (m_parentScene.ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)obj).UUID, avatar_deleter)) |
292 | m_numPrim--; | 292 | { |
293 | m_parentScene.RemoveEntity((SceneObjectGroup)obj); | ||
294 | m_numPrim--; | ||
295 | } | ||
293 | return; | 296 | return; |
294 | } | 297 | } |
295 | } | 298 | } |
@@ -998,12 +1001,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
998 | if (group != null) | 1001 | if (group != null) |
999 | { | 1002 | { |
1000 | LLVector3 oldPos = group.AbsolutePosition; | 1003 | LLVector3 oldPos = group.AbsolutePosition; |
1001 | //FIXME: ObjectEntry is not in ExternalChecks! | 1004 | if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment) |
1002 | //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) | 1005 | { |
1003 | //{ | ||
1004 | group.SendGroupTerseUpdate(); | 1006 | group.SendGroupTerseUpdate(); |
1005 | //return; | 1007 | return; |
1006 | //} | 1008 | } |
1007 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) | 1009 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) |
1008 | { | 1010 | { |
1009 | group.UpdateSinglePosition(pos, localID); | 1011 | group.UpdateSinglePosition(pos, localID); |
@@ -1030,12 +1032,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1030 | } | 1032 | } |
1031 | else | 1033 | else |
1032 | { | 1034 | { |
1033 | //FIXME: ObjectEntry not in ExternalChecks! | 1035 | if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment) |
1034 | //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) | 1036 | { |
1035 | //{ | ||
1036 | group.SendGroupTerseUpdate(); | 1037 | group.SendGroupTerseUpdate(); |
1037 | // return; | 1038 | return; |
1038 | //} | 1039 | } |
1039 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment) | 1040 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment) |
1040 | { | 1041 | { |
1041 | group.UpdateGroupPosition(pos); | 1042 | group.UpdateGroupPosition(pos); |
@@ -1055,7 +1056,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1055 | SceneObjectGroup group = GetGroupByPrim(localID); | 1056 | SceneObjectGroup group = GetGroupByPrim(localID); |
1056 | if (group != null) | 1057 | if (group != null) |
1057 | { | 1058 | { |
1058 | if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID,remoteClient.AgentId)) | 1059 | if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID,remoteClient.AgentId)) |
1059 | { | 1060 | { |
1060 | group.UpdateTextureEntry(localID, texture); | 1061 | group.UpdateTextureEntry(localID, texture); |
1061 | } | 1062 | } |
@@ -1378,7 +1379,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1378 | 1379 | ||
1379 | if (originPrim != null) | 1380 | if (originPrim != null) |
1380 | { | 1381 | { |
1381 | if (m_parentScene.ExternalChecks.ExternalChecksCanCopyObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition)) | 1382 | if (m_parentScene.ExternalChecks.ExternalChecksCanDuplicateObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition)) |
1382 | { | 1383 | { |
1383 | SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); | 1384 | SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); |
1384 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 1385 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 782d5b4..cbb3a7d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -988,17 +988,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
988 | } | 988 | } |
989 | if (selectedEnt != null) | 989 | if (selectedEnt != null) |
990 | { | 990 | { |
991 | bool permission; | 991 | bool permissionToTake = false; |
992 | if (DeRezPacket.AgentBlock.Destination == 1) | 992 | bool permissionToDelete = false; |
993 | { // Take Copy | 993 | if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy |
994 | permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | 994 | { |
995 | permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
996 | permissionToDelete = false; //Just taking copy! | ||
997 | |||
995 | } | 998 | } |
996 | else | 999 | else if(DeRezPacket.AgentBlock.Destination == 4) //Take |
997 | { // Take | 1000 | { |
998 | permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | 1001 | // Take |
1002 | permissionToTake = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
1003 | permissionToDelete = permissionToTake; //If they can take, they can delete! | ||
1004 | } | ||
1005 | |||
1006 | else if (DeRezPacket.AgentBlock.Destination == 6) //Delete | ||
1007 | { | ||
1008 | permissionToTake = false; | ||
1009 | permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
999 | } | 1010 | } |
1000 | 1011 | ||
1001 | if (permission) | 1012 | if (permissionToTake) |
1002 | { | 1013 | { |
1003 | SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt; | 1014 | SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt; |
1004 | string sceneObjectXml = objectGroup.ToXmlString(); | 1015 | string sceneObjectXml = objectGroup.ToXmlString(); |
@@ -1044,8 +1055,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1044 | remoteClient.SendInventoryItemCreateUpdate(item); | 1055 | remoteClient.SendInventoryItemCreateUpdate(item); |
1045 | } | 1056 | } |
1046 | 1057 | ||
1047 | // FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy | 1058 | if (permissionToDelete) |
1048 | if (DeRezPacket.AgentBlock.Destination != 1) | ||
1049 | { | 1059 | { |
1050 | DeleteSceneObjectGroup(objectGroup); | 1060 | DeleteSceneObjectGroup(objectGroup); |
1051 | } | 1061 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f0a0921..faa595f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1146,13 +1146,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1146 | m_log.Info("[SCENE]: Loading land objects from storage"); | 1146 | m_log.Info("[SCENE]: Loading land objects from storage"); |
1147 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); | 1147 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); |
1148 | 1148 | ||
1149 | if (landData.Count == 0) | 1149 | if (LandChannel != null) |
1150 | { | 1150 | { |
1151 | LandChannel.NoLandDataFromStorage(); | 1151 | if (landData.Count == 0) |
1152 | { | ||
1153 | LandChannel.NoLandDataFromStorage(); | ||
1154 | } | ||
1155 | else | ||
1156 | { | ||
1157 | LandChannel.IncomingLandObjectsFromStorage(landData); | ||
1158 | } | ||
1152 | } | 1159 | } |
1153 | else | 1160 | else |
1154 | { | 1161 | { |
1155 | LandChannel.IncomingLandObjectsFromStorage(landData); | 1162 | m_log.Error("[SCENE]: Land Channel is not defined. Cannot load from storage!"); |
1156 | } | 1163 | } |
1157 | } | 1164 | } |
1158 | 1165 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index e7e4caf..285ee0d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |||
@@ -74,24 +74,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
74 | 74 | ||
75 | #endregion | 75 | #endregion |
76 | 76 | ||
77 | #region DEREZ OBJECT | 77 | #region DELETE OBJECT |
78 | public delegate bool CanDeRezObject(LLUUID objectID, LLUUID deleter, Scene scene); | 78 | public delegate bool CanDeleteObject(LLUUID objectID, LLUUID deleter, Scene scene); |
79 | private List<CanDeRezObject> CanDeRezObjectCheckFunctions = new List<CanDeRezObject>(); | 79 | private List<CanDeleteObject> CanDeleteObjectCheckFunctions = new List<CanDeleteObject>(); |
80 | 80 | ||
81 | public void addCheckDeRezObject(CanDeRezObject delegateFunc) | 81 | public void addCheckDeleteObject(CanDeleteObject delegateFunc) |
82 | { | 82 | { |
83 | if (!CanDeRezObjectCheckFunctions.Contains(delegateFunc)) | 83 | if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc)) |
84 | CanDeRezObjectCheckFunctions.Add(delegateFunc); | 84 | CanDeleteObjectCheckFunctions.Add(delegateFunc); |
85 | } | 85 | } |
86 | public void removeCheckDeRezObject(CanDeRezObject delegateFunc) | 86 | public void removeCheckDeleteObject(CanDeleteObject delegateFunc) |
87 | { | 87 | { |
88 | if (CanDeRezObjectCheckFunctions.Contains(delegateFunc)) | 88 | if (CanDeleteObjectCheckFunctions.Contains(delegateFunc)) |
89 | CanDeRezObjectCheckFunctions.Remove(delegateFunc); | 89 | CanDeleteObjectCheckFunctions.Remove(delegateFunc); |
90 | } | 90 | } |
91 | 91 | ||
92 | public bool ExternalChecksCanDeRezObject(LLUUID objectID, LLUUID deleter) | 92 | public bool ExternalChecksCanDeleteObject(LLUUID objectID, LLUUID deleter) |
93 | { | 93 | { |
94 | foreach (CanDeRezObject check in CanDeRezObjectCheckFunctions) | 94 | foreach (CanDeleteObject check in CanDeleteObjectCheckFunctions) |
95 | { | 95 | { |
96 | if (check(objectID,deleter,m_scene) == false) | 96 | if (check(objectID,deleter,m_scene) == false) |
97 | { | 97 | { |
@@ -132,24 +132,53 @@ namespace OpenSim.Region.Environment.Scenes | |||
132 | 132 | ||
133 | #endregion | 133 | #endregion |
134 | 134 | ||
135 | #region COPY OBJECT | 135 | #region TAKE COPY OBJECT |
136 | public delegate bool CanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition); | 136 | public delegate bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene); |
137 | private List<CanCopyObject> CanCopyObjectCheckFunctions = new List<CanCopyObject>(); | 137 | private List<CanTakeCopyObject> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObject>(); |
138 | 138 | ||
139 | public void addCheckCopyObject(CanCopyObject delegateFunc) | 139 | public void addCheckTakeCopyObject(CanTakeCopyObject delegateFunc) |
140 | { | 140 | { |
141 | if (!CanCopyObjectCheckFunctions.Contains(delegateFunc)) | 141 | if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) |
142 | CanCopyObjectCheckFunctions.Add(delegateFunc); | 142 | CanTakeCopyObjectCheckFunctions.Add(delegateFunc); |
143 | } | 143 | } |
144 | public void removeCheckCopyObject(CanCopyObject delegateFunc) | 144 | public void removeCheckTakeCopyObject(CanTakeCopyObject delegateFunc) |
145 | { | 145 | { |
146 | if (CanCopyObjectCheckFunctions.Contains(delegateFunc)) | 146 | if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) |
147 | CanCopyObjectCheckFunctions.Remove(delegateFunc); | 147 | CanTakeCopyObjectCheckFunctions.Remove(delegateFunc); |
148 | } | 148 | } |
149 | 149 | ||
150 | public bool ExternalChecksCanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition) | 150 | public bool ExternalChecksCanTakeCopyObject(LLUUID objectID, LLUUID userID) |
151 | { | 151 | { |
152 | foreach (CanCopyObject check in CanCopyObjectCheckFunctions) | 152 | foreach (CanTakeCopyObject check in CanTakeCopyObjectCheckFunctions) |
153 | { | ||
154 | if (check(objectID,userID,m_scene) == false) | ||
155 | { | ||
156 | return false; | ||
157 | } | ||
158 | } | ||
159 | return true; | ||
160 | } | ||
161 | |||
162 | #endregion | ||
163 | |||
164 | #region DUPLICATE OBJECT | ||
165 | public delegate bool CanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition); | ||
166 | private List<CanDuplicateObject> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObject>(); | ||
167 | |||
168 | public void addCheckDuplicateObject(CanDuplicateObject delegateFunc) | ||
169 | { | ||
170 | if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc)) | ||
171 | CanDuplicateObjectCheckFunctions.Add(delegateFunc); | ||
172 | } | ||
173 | public void removeCheckDuplicateObject(CanDuplicateObject delegateFunc) | ||
174 | { | ||
175 | if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc)) | ||
176 | CanDuplicateObjectCheckFunctions.Remove(delegateFunc); | ||
177 | } | ||
178 | |||
179 | public bool ExternalChecksCanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition) | ||
180 | { | ||
181 | foreach (CanDuplicateObject check in CanDuplicateObjectCheckFunctions) | ||
153 | { | 182 | { |
154 | if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) | 183 | if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) |
155 | { | 184 | { |
@@ -219,6 +248,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
219 | 248 | ||
220 | #endregion | 249 | #endregion |
221 | 250 | ||
251 | #region OBJECT ENTRY | ||
252 | public delegate bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene); | ||
253 | private List<CanObjectEntry> CanObjectEntryCheckFunctions = new List<CanObjectEntry>(); | ||
254 | |||
255 | public void addCheckObjectEntry(CanObjectEntry delegateFunc) | ||
256 | { | ||
257 | if (!CanObjectEntryCheckFunctions.Contains(delegateFunc)) | ||
258 | CanObjectEntryCheckFunctions.Add(delegateFunc); | ||
259 | } | ||
260 | public void removeCheckObjectEntry(CanObjectEntry delegateFunc) | ||
261 | { | ||
262 | if (CanObjectEntryCheckFunctions.Contains(delegateFunc)) | ||
263 | CanObjectEntryCheckFunctions.Remove(delegateFunc); | ||
264 | } | ||
265 | |||
266 | public bool ExternalChecksCanObjectEntry(LLUUID objectID, LLVector3 newPoint) | ||
267 | { | ||
268 | foreach (CanObjectEntry check in CanObjectEntryCheckFunctions) | ||
269 | { | ||
270 | if (check(objectID, newPoint, m_scene) == false) | ||
271 | { | ||
272 | return false; | ||
273 | } | ||
274 | } | ||
275 | return true; | ||
276 | } | ||
277 | |||
278 | #endregion | ||
279 | |||
222 | #region RETURN OBJECT | 280 | #region RETURN OBJECT |
223 | public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene); | 281 | public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene); |
224 | private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>(); | 282 | private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>(); |
@@ -248,10 +306,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
248 | 306 | ||
249 | #endregion | 307 | #endregion |
250 | 308 | ||
251 | #endregion | ||
252 | |||
253 | #region Misc Permission Checks | ||
254 | |||
255 | #region INSTANT MESSAGE | 309 | #region INSTANT MESSAGE |
256 | public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene); | 310 | public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene); |
257 | private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>(); | 311 | private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>(); |
@@ -271,7 +325,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
271 | { | 325 | { |
272 | foreach (CanInstantMessage check in CanInstantMessageCheckFunctions) | 326 | foreach (CanInstantMessage check in CanInstantMessageCheckFunctions) |
273 | { | 327 | { |
274 | if (check(user,target,m_scene) == false) | 328 | if (check(user, target, m_scene) == false) |
275 | { | 329 | { |
276 | return false; | 330 | return false; |
277 | } | 331 | } |
@@ -310,6 +364,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
310 | 364 | ||
311 | #endregion | 365 | #endregion |
312 | 366 | ||
367 | #region VIEW SCRIPT | ||
368 | public delegate bool CanViewScript(LLUUID script, LLUUID user, Scene scene); | ||
369 | private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>(); | ||
370 | |||
371 | public void addCheckViewScript(CanViewScript delegateFunc) | ||
372 | { | ||
373 | if (!CanViewScriptCheckFunctions.Contains(delegateFunc)) | ||
374 | CanViewScriptCheckFunctions.Add(delegateFunc); | ||
375 | } | ||
376 | public void removeCheckViewScript(CanViewScript delegateFunc) | ||
377 | { | ||
378 | if (CanViewScriptCheckFunctions.Contains(delegateFunc)) | ||
379 | CanViewScriptCheckFunctions.Remove(delegateFunc); | ||
380 | } | ||
381 | |||
382 | public bool ExternalChecksCanViewScript(LLUUID script, LLUUID user) | ||
383 | { | ||
384 | foreach (CanViewScript check in CanViewScriptCheckFunctions) | ||
385 | { | ||
386 | if (check(script, user, m_scene) == false) | ||
387 | { | ||
388 | return false; | ||
389 | } | ||
390 | } | ||
391 | return true; | ||
392 | } | ||
393 | |||
394 | #endregion | ||
395 | |||
313 | #region EDIT SCRIPT | 396 | #region EDIT SCRIPT |
314 | public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene); | 397 | public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene); |
315 | private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>(); | 398 | private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>(); |
@@ -369,23 +452,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
369 | #endregion | 452 | #endregion |
370 | 453 | ||
371 | #region TERRAFORM LAND | 454 | #region TERRAFORM LAND |
372 | public delegate bool CanTerraformLandCommand(LLUUID user, LLVector3 position, Scene requestFromScene); | 455 | public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene); |
373 | private List<CanTerraformLandCommand> CanTerraformLandCommandCheckFunctions = new List<CanTerraformLandCommand>(); | 456 | private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>(); |
374 | 457 | ||
375 | public void addCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) | 458 | public void addCheckTerraformLand(CanTerraformLand delegateFunc) |
376 | { | 459 | { |
377 | if (!CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) | 460 | if (!CanTerraformLandCheckFunctions.Contains(delegateFunc)) |
378 | CanTerraformLandCommandCheckFunctions.Add(delegateFunc); | 461 | CanTerraformLandCheckFunctions.Add(delegateFunc); |
379 | } | 462 | } |
380 | public void removeCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) | 463 | public void removeCheckTerraformLand(CanTerraformLand delegateFunc) |
381 | { | 464 | { |
382 | if (CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) | 465 | if (CanTerraformLandCheckFunctions.Contains(delegateFunc)) |
383 | CanTerraformLandCommandCheckFunctions.Remove(delegateFunc); | 466 | CanTerraformLandCheckFunctions.Remove(delegateFunc); |
384 | } | 467 | } |
385 | 468 | ||
386 | public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos) | 469 | public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos) |
387 | { | 470 | { |
388 | foreach (CanTerraformLandCommand check in CanTerraformLandCommandCheckFunctions) | 471 | foreach (CanTerraformLand check in CanTerraformLandCheckFunctions) |
389 | { | 472 | { |
390 | if (check(user, pos, m_scene) == false) | 473 | if (check(user, pos, m_scene) == false) |
391 | { | 474 | { |
@@ -426,6 +509,34 @@ namespace OpenSim.Region.Environment.Scenes | |||
426 | 509 | ||
427 | #endregion | 510 | #endregion |
428 | 511 | ||
512 | #region CAN ISSUE ESTATE COMMAND | ||
513 | public delegate bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene); | ||
514 | private List<CanIssueEstateCommand> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommand>(); | ||
515 | |||
516 | public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc) | ||
517 | { | ||
518 | if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc)) | ||
519 | CanIssueEstateCommandCheckFunctions.Add(delegateFunc); | ||
520 | } | ||
521 | public void removeCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc) | ||
522 | { | ||
523 | if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc)) | ||
524 | CanIssueEstateCommandCheckFunctions.Remove(delegateFunc); | ||
525 | } | ||
526 | |||
527 | public bool ExternalChecksCanIssueEstateCommand(LLUUID user) | ||
528 | { | ||
529 | foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions) | ||
530 | { | ||
531 | if (check(user, m_scene) == false) | ||
532 | { | ||
533 | return false; | ||
534 | } | ||
535 | } | ||
536 | return true; | ||
537 | } | ||
538 | #endregion | ||
539 | |||
429 | #region CAN BE GODLIKE | 540 | #region CAN BE GODLIKE |
430 | public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene); | 541 | public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene); |
431 | private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>(); | 542 | private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>(); |
@@ -452,154 +563,95 @@ namespace OpenSim.Region.Environment.Scenes | |||
452 | } | 563 | } |
453 | return true; | 564 | return true; |
454 | } | 565 | } |
455 | |||
456 | #endregion | 566 | #endregion |
457 | 567 | ||
458 | #endregion | 568 | #region EDIT PARCEL |
459 | 569 | public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene); | |
460 | #region Parcel and Estate Permission Checks | 570 | private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>(); |
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 | 571 | ||
490 | #region RESTART SIM | 572 | public void addCheckEditParcel(CanEditParcel delegateFunc) |
491 | public delegate bool CanRestartSim(LLUUID user, Scene scene); | 573 | { |
492 | private List<CanRestartSim> CanRestartSimCheckFunctions = new List<CanRestartSim>(); | 574 | if (!CanEditParcelCheckFunctions.Contains(delegateFunc)) |
493 | 575 | CanEditParcelCheckFunctions.Add(delegateFunc); | |
494 | public void addCheckRestartSim(CanRestartSim delegateFunc) | 576 | } |
495 | { | 577 | public void removeCheckEditParcel(CanEditParcel delegateFunc) |
496 | if (!CanRestartSimCheckFunctions.Contains(delegateFunc)) | 578 | { |
497 | CanRestartSimCheckFunctions.Add(delegateFunc); | 579 | if (CanEditParcelCheckFunctions.Contains(delegateFunc)) |
498 | } | 580 | CanEditParcelCheckFunctions.Remove(delegateFunc); |
499 | public void removeCheckRestartSim(CanRestartSim delegateFunc) | 581 | } |
500 | { | ||
501 | if (CanRestartSimCheckFunctions.Contains(delegateFunc)) | ||
502 | CanRestartSimCheckFunctions.Remove(delegateFunc); | ||
503 | } | ||
504 | 582 | ||
505 | public bool ExternalChecksCanRestartSim(LLUUID user) | 583 | public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel) |
584 | { | ||
585 | foreach (CanEditParcel check in CanEditParcelCheckFunctions) | ||
506 | { | 586 | { |
507 | foreach (CanRestartSim check in CanRestartSimCheckFunctions) | 587 | if (check(user, parcel, m_scene) == false) |
508 | { | 588 | { |
509 | if (check(user, m_scene) == false) | 589 | return false; |
510 | { | ||
511 | return false; | ||
512 | } | ||
513 | } | 590 | } |
514 | return true; | ||
515 | } | 591 | } |
592 | return true; | ||
593 | } | ||
516 | #endregion | 594 | #endregion |
517 | 595 | ||
518 | #region EDIT PARCEL | 596 | #region SELL PARCEL |
519 | public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene); | 597 | public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene); |
520 | private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>(); | 598 | private List<CanSellParcel> CanSellParcelCheckFunctions = new List<CanSellParcel>(); |
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 | 599 | ||
533 | public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel) | 600 | public void addCheckSellParcel(CanSellParcel delegateFunc) |
534 | { | 601 | { |
535 | foreach (CanEditParcel check in CanEditParcelCheckFunctions) | 602 | if (!CanSellParcelCheckFunctions.Contains(delegateFunc)) |
536 | { | 603 | CanSellParcelCheckFunctions.Add(delegateFunc); |
537 | if (check(user, parcel, m_scene) == false) | 604 | } |
538 | { | 605 | public void removeCheckSellParcel(CanSellParcel delegateFunc) |
539 | return false; | 606 | { |
540 | } | 607 | if (CanSellParcelCheckFunctions.Contains(delegateFunc)) |
541 | } | 608 | CanSellParcelCheckFunctions.Remove(delegateFunc); |
542 | return true; | 609 | } |
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 | 610 | ||
561 | public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel) | 611 | public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel) |
612 | { | ||
613 | foreach (CanSellParcel check in CanSellParcelCheckFunctions) | ||
614 | { | ||
615 | if (check(user, parcel, m_scene) == false) | ||
562 | { | 616 | { |
563 | foreach (CanSellParcel check in CanSellParcelCheckFunctions) | 617 | return false; |
564 | { | ||
565 | if (check(user, parcel, m_scene) == false) | ||
566 | { | ||
567 | return false; | ||
568 | } | ||
569 | } | ||
570 | return true; | ||
571 | } | 618 | } |
572 | #endregion | 619 | } |
620 | return true; | ||
621 | } | ||
622 | #endregion | ||
573 | 623 | ||
574 | #region ABANDON PARCEL | 624 | #region ABANDON PARCEL |
575 | public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene); | 625 | public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene); |
576 | private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>(); | 626 | private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>(); |
577 | 627 | ||
578 | public void addCheckAbandonParcel(CanAbandonParcel delegateFunc) | 628 | public void addCheckAbandonParcel(CanAbandonParcel delegateFunc) |
579 | { | 629 | { |
580 | if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) | 630 | if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) |
581 | CanAbandonParcelCheckFunctions.Add(delegateFunc); | 631 | CanAbandonParcelCheckFunctions.Add(delegateFunc); |
582 | } | 632 | } |
583 | public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc) | 633 | public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc) |
584 | { | 634 | { |
585 | if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) | 635 | if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) |
586 | CanAbandonParcelCheckFunctions.Remove(delegateFunc); | 636 | CanAbandonParcelCheckFunctions.Remove(delegateFunc); |
587 | } | 637 | } |
588 | 638 | ||
589 | public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel) | 639 | public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel) |
640 | { | ||
641 | foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) | ||
642 | { | ||
643 | if (check(user, parcel, m_scene) == false) | ||
590 | { | 644 | { |
591 | foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) | 645 | return false; |
592 | { | ||
593 | if (check(user, parcel, m_scene) == false) | ||
594 | { | ||
595 | return false; | ||
596 | } | ||
597 | } | ||
598 | return true; | ||
599 | } | 646 | } |
600 | #endregion | 647 | } |
648 | return true; | ||
649 | } | ||
601 | #endregion | 650 | #endregion |
602 | 651 | ||
652 | #endregion | ||
653 | |||
603 | 654 | ||
604 | } | 655 | } |
605 | } | 656 | } |
657 | \ No newline at end of file | ||