diff options
author | Melanie Thielker | 2008-11-21 22:14:57 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-21 22:14:57 +0000 |
commit | ba723a4cf65e7a82f5072eaab51dc008f4a2bfd9 (patch) | |
tree | db636daea691f80b0d8bfd3970b8ced36ef9ced0 /OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |
parent | * Comment out unused access time method in MSSQL (diff) | |
download | opensim-SC-ba723a4cf65e7a82f5072eaab51dc008f4a2bfd9.zip opensim-SC-ba723a4cf65e7a82f5072eaab51dc008f4a2bfd9.tar.gz opensim-SC-ba723a4cf65e7a82f5072eaab51dc008f4a2bfd9.tar.bz2 opensim-SC-ba723a4cf65e7a82f5072eaab51dc008f4a2bfd9.tar.xz |
Refactor: Scene.ExternalChecks -> Scene.Permissions. Also make all
the internals of the permissions module adapter sane
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | 1334 |
1 files changed, 0 insertions, 1334 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs deleted file mode 100644 index 0977734..0000000 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ /dev/null | |||
@@ -1,1334 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Environment.Interfaces; | ||
34 | |||
35 | namespace OpenSim.Region.Environment.Scenes | ||
36 | { | ||
37 | public class SceneExternalChecks | ||
38 | { | ||
39 | private Scene m_scene; | ||
40 | |||
41 | public SceneExternalChecks(Scene scene) | ||
42 | { | ||
43 | m_scene = scene; | ||
44 | } | ||
45 | |||
46 | #region Object Permission Checks | ||
47 | |||
48 | public delegate uint GenerateClientFlags(UUID userID, UUID objectIDID); | ||
49 | private List<GenerateClientFlags> GenerateClientFlagsCheckFunctions = new List<GenerateClientFlags>(); | ||
50 | |||
51 | public void addGenerateClientFlags(GenerateClientFlags delegateFunc) | ||
52 | { | ||
53 | if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) | ||
54 | GenerateClientFlagsCheckFunctions.Add(delegateFunc); | ||
55 | } | ||
56 | |||
57 | public void removeGenerateClientFlags(GenerateClientFlags delegateFunc) | ||
58 | { | ||
59 | if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) | ||
60 | GenerateClientFlagsCheckFunctions.Remove(delegateFunc); | ||
61 | } | ||
62 | |||
63 | public uint ExternalChecksGenerateClientFlags(UUID userID, UUID objectID) | ||
64 | { | ||
65 | SceneObjectPart part=m_scene.GetSceneObjectPart(objectID); | ||
66 | |||
67 | if (part == null) | ||
68 | return 0; | ||
69 | |||
70 | // libomv will moan about PrimFlags.ObjectYouOfficer being | ||
71 | // obsolete... | ||
72 | #pragma warning disable 0612 | ||
73 | uint perms=part.GetEffectiveObjectFlags() | | ||
74 | (uint)PrimFlags.ObjectModify | | ||
75 | (uint)PrimFlags.ObjectCopy | | ||
76 | (uint)PrimFlags.ObjectMove | | ||
77 | (uint)PrimFlags.ObjectTransfer | | ||
78 | (uint)PrimFlags.ObjectYouOwner | | ||
79 | (uint)PrimFlags.ObjectAnyOwner | | ||
80 | (uint)PrimFlags.ObjectOwnerModify | | ||
81 | (uint)PrimFlags.ObjectYouOfficer; | ||
82 | #pragma warning restore 0612 | ||
83 | |||
84 | foreach (GenerateClientFlags check in GenerateClientFlagsCheckFunctions) | ||
85 | { | ||
86 | perms &= check(userID, objectID); | ||
87 | } | ||
88 | return perms; | ||
89 | } | ||
90 | |||
91 | public delegate void SetBypassPermissions(bool value); | ||
92 | private List<SetBypassPermissions> SetBypassPermissionsCheckFunctions = new List<SetBypassPermissions>(); | ||
93 | |||
94 | public void addSetBypassPermissions(SetBypassPermissions delegateFunc) | ||
95 | { | ||
96 | if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc)) | ||
97 | SetBypassPermissionsCheckFunctions.Add(delegateFunc); | ||
98 | } | ||
99 | |||
100 | public void removeSetBypassPermissions(SetBypassPermissions delegateFunc) | ||
101 | { | ||
102 | if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc)) | ||
103 | SetBypassPermissionsCheckFunctions.Remove(delegateFunc); | ||
104 | } | ||
105 | |||
106 | public void ExternalChecksSetBypassPermissions(bool value) | ||
107 | { | ||
108 | foreach (SetBypassPermissions check in SetBypassPermissionsCheckFunctions) | ||
109 | { | ||
110 | check(value); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | public delegate bool BypassPermissions(); | ||
115 | private List<BypassPermissions> BypassPermissionsCheckFunctions = new List<BypassPermissions>(); | ||
116 | |||
117 | public void addBypassPermissions(BypassPermissions delegateFunc) | ||
118 | { | ||
119 | if (!BypassPermissionsCheckFunctions.Contains(delegateFunc)) | ||
120 | BypassPermissionsCheckFunctions.Add(delegateFunc); | ||
121 | } | ||
122 | |||
123 | public void removeBypassPermissions(BypassPermissions delegateFunc) | ||
124 | { | ||
125 | if (BypassPermissionsCheckFunctions.Contains(delegateFunc)) | ||
126 | BypassPermissionsCheckFunctions.Remove(delegateFunc); | ||
127 | } | ||
128 | |||
129 | public bool ExternalChecksBypassPermissions() | ||
130 | { | ||
131 | foreach (BypassPermissions check in BypassPermissionsCheckFunctions) | ||
132 | { | ||
133 | if (check() == false) | ||
134 | { | ||
135 | return false; | ||
136 | } | ||
137 | } | ||
138 | return true; | ||
139 | } | ||
140 | |||
141 | public delegate bool PropagatePermissions(); | ||
142 | private List<PropagatePermissions> PropagatePermissionsCheckFunctions = new List<PropagatePermissions>(); | ||
143 | |||
144 | public void addPropagatePermissions(PropagatePermissions delegateFunc) | ||
145 | { | ||
146 | if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc)) | ||
147 | PropagatePermissionsCheckFunctions.Add(delegateFunc); | ||
148 | } | ||
149 | |||
150 | public void removePropagatePermissions(PropagatePermissions delegateFunc) | ||
151 | { | ||
152 | if (PropagatePermissionsCheckFunctions.Contains(delegateFunc)) | ||
153 | PropagatePermissionsCheckFunctions.Remove(delegateFunc); | ||
154 | } | ||
155 | |||
156 | public bool ExternalChecksPropagatePermissions() | ||
157 | { | ||
158 | foreach (PropagatePermissions check in PropagatePermissionsCheckFunctions) | ||
159 | { | ||
160 | if (check() == false) | ||
161 | { | ||
162 | return false; | ||
163 | } | ||
164 | } | ||
165 | return true; | ||
166 | } | ||
167 | |||
168 | #region REZ OBJECT | ||
169 | public delegate bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); | ||
170 | private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>(); | ||
171 | |||
172 | public void addCheckRezObject(CanRezObject delegateFunc) | ||
173 | { | ||
174 | if (!CanRezObjectCheckFunctions.Contains(delegateFunc)) | ||
175 | CanRezObjectCheckFunctions.Add(delegateFunc); | ||
176 | } | ||
177 | |||
178 | public void removeCheckRezObject(CanRezObject delegateFunc) | ||
179 | { | ||
180 | if (CanRezObjectCheckFunctions.Contains(delegateFunc)) | ||
181 | CanRezObjectCheckFunctions.Remove(delegateFunc); | ||
182 | } | ||
183 | |||
184 | public bool ExternalChecksCanRezObject(int objectCount, UUID owner, Vector3 objectPosition) | ||
185 | { | ||
186 | foreach (CanRezObject check in CanRezObjectCheckFunctions) | ||
187 | { | ||
188 | if (check(objectCount, owner,objectPosition, m_scene) == false) | ||
189 | { | ||
190 | return false; | ||
191 | } | ||
192 | } | ||
193 | return true; | ||
194 | } | ||
195 | |||
196 | #endregion | ||
197 | |||
198 | #region DELETE OBJECT | ||
199 | public delegate bool CanDeleteObject(UUID objectID, UUID deleter, Scene scene); | ||
200 | private List<CanDeleteObject> CanDeleteObjectCheckFunctions = new List<CanDeleteObject>(); | ||
201 | |||
202 | public void addCheckDeleteObject(CanDeleteObject delegateFunc) | ||
203 | { | ||
204 | if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc)) | ||
205 | CanDeleteObjectCheckFunctions.Add(delegateFunc); | ||
206 | } | ||
207 | |||
208 | public void removeCheckDeleteObject(CanDeleteObject delegateFunc) | ||
209 | { | ||
210 | if (CanDeleteObjectCheckFunctions.Contains(delegateFunc)) | ||
211 | CanDeleteObjectCheckFunctions.Remove(delegateFunc); | ||
212 | } | ||
213 | |||
214 | public bool ExternalChecksCanDeleteObject(UUID objectID, UUID deleter) | ||
215 | { | ||
216 | foreach (CanDeleteObject check in CanDeleteObjectCheckFunctions) | ||
217 | { | ||
218 | if (check(objectID,deleter,m_scene) == false) | ||
219 | { | ||
220 | return false; | ||
221 | } | ||
222 | } | ||
223 | return true; | ||
224 | } | ||
225 | |||
226 | #endregion | ||
227 | |||
228 | #region TAKE OBJECT | ||
229 | public delegate bool CanTakeObject(UUID objectID, UUID stealer, Scene scene); | ||
230 | private List<CanTakeObject> CanTakeObjectCheckFunctions = new List<CanTakeObject>(); | ||
231 | |||
232 | public void addCheckTakeObject(CanTakeObject delegateFunc) | ||
233 | { | ||
234 | if (!CanTakeObjectCheckFunctions.Contains(delegateFunc)) | ||
235 | CanTakeObjectCheckFunctions.Add(delegateFunc); | ||
236 | } | ||
237 | |||
238 | public void removeCheckTakeObject(CanTakeObject delegateFunc) | ||
239 | { | ||
240 | if (CanTakeObjectCheckFunctions.Contains(delegateFunc)) | ||
241 | CanTakeObjectCheckFunctions.Remove(delegateFunc); | ||
242 | } | ||
243 | |||
244 | public bool ExternalChecksCanTakeObject(UUID objectID, UUID AvatarTakingUUID) | ||
245 | { | ||
246 | foreach (CanTakeObject check in CanTakeObjectCheckFunctions) | ||
247 | { | ||
248 | if (check(objectID, AvatarTakingUUID, m_scene) == false) | ||
249 | { | ||
250 | return false; | ||
251 | } | ||
252 | } | ||
253 | return true; | ||
254 | } | ||
255 | |||
256 | #endregion | ||
257 | |||
258 | #region TAKE COPY OBJECT | ||
259 | public delegate bool CanTakeCopyObject(UUID objectID, UUID userID, Scene inScene); | ||
260 | private List<CanTakeCopyObject> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObject>(); | ||
261 | |||
262 | public void addCheckTakeCopyObject(CanTakeCopyObject delegateFunc) | ||
263 | { | ||
264 | if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) | ||
265 | CanTakeCopyObjectCheckFunctions.Add(delegateFunc); | ||
266 | } | ||
267 | |||
268 | public void removeCheckTakeCopyObject(CanTakeCopyObject delegateFunc) | ||
269 | { | ||
270 | if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) | ||
271 | CanTakeCopyObjectCheckFunctions.Remove(delegateFunc); | ||
272 | } | ||
273 | |||
274 | public bool ExternalChecksCanTakeCopyObject(UUID objectID, UUID userID) | ||
275 | { | ||
276 | foreach (CanTakeCopyObject check in CanTakeCopyObjectCheckFunctions) | ||
277 | { | ||
278 | if (check(objectID,userID,m_scene) == false) | ||
279 | { | ||
280 | return false; | ||
281 | } | ||
282 | } | ||
283 | return true; | ||
284 | } | ||
285 | |||
286 | #endregion | ||
287 | |||
288 | #region DUPLICATE OBJECT | ||
289 | public delegate bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); | ||
290 | private List<CanDuplicateObject> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObject>(); | ||
291 | |||
292 | public void addCheckDuplicateObject(CanDuplicateObject delegateFunc) | ||
293 | { | ||
294 | if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc)) | ||
295 | CanDuplicateObjectCheckFunctions.Add(delegateFunc); | ||
296 | } | ||
297 | |||
298 | public void removeCheckDuplicateObject(CanDuplicateObject delegateFunc) | ||
299 | { | ||
300 | if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc)) | ||
301 | CanDuplicateObjectCheckFunctions.Remove(delegateFunc); | ||
302 | } | ||
303 | |||
304 | public bool ExternalChecksCanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition) | ||
305 | { | ||
306 | foreach (CanDuplicateObject check in CanDuplicateObjectCheckFunctions) | ||
307 | { | ||
308 | if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) | ||
309 | { | ||
310 | return false; | ||
311 | } | ||
312 | } | ||
313 | return true; | ||
314 | } | ||
315 | |||
316 | #endregion | ||
317 | |||
318 | #region EDIT OBJECT | ||
319 | public delegate bool CanEditObject(UUID objectID, UUID editorID, Scene scene); | ||
320 | private List<CanEditObject> CanEditObjectCheckFunctions = new List<CanEditObject>(); | ||
321 | |||
322 | public void addCheckEditObject(CanEditObject delegateFunc) | ||
323 | { | ||
324 | if (!CanEditObjectCheckFunctions.Contains(delegateFunc)) | ||
325 | CanEditObjectCheckFunctions.Add(delegateFunc); | ||
326 | } | ||
327 | |||
328 | public void removeCheckEditObject(CanEditObject delegateFunc) | ||
329 | { | ||
330 | if (CanEditObjectCheckFunctions.Contains(delegateFunc)) | ||
331 | CanEditObjectCheckFunctions.Remove(delegateFunc); | ||
332 | } | ||
333 | |||
334 | public bool ExternalChecksCanEditObject(UUID objectID, UUID editorID) | ||
335 | { | ||
336 | foreach (CanEditObject check in CanEditObjectCheckFunctions) | ||
337 | { | ||
338 | if (check(objectID, editorID, m_scene) == false) | ||
339 | { | ||
340 | return false; | ||
341 | } | ||
342 | } | ||
343 | return true; | ||
344 | } | ||
345 | |||
346 | public delegate bool CanEditObjectInventory(UUID objectID, UUID editorID, Scene scene); | ||
347 | private List<CanEditObjectInventory> CanEditObjectInventoryCheckFunctions = new List<CanEditObjectInventory>(); | ||
348 | |||
349 | public void addCheckEditObjectInventory(CanEditObjectInventory delegateFunc) | ||
350 | { | ||
351 | if (!CanEditObjectInventoryCheckFunctions.Contains(delegateFunc)) | ||
352 | CanEditObjectInventoryCheckFunctions.Add(delegateFunc); | ||
353 | } | ||
354 | |||
355 | public void removeCheckEditObjectInventory(CanEditObjectInventory delegateFunc) | ||
356 | { | ||
357 | if (CanEditObjectInventoryCheckFunctions.Contains(delegateFunc)) | ||
358 | CanEditObjectInventoryCheckFunctions.Remove(delegateFunc); | ||
359 | } | ||
360 | |||
361 | public bool ExternalChecksCanEditObjectInventory(UUID objectID, UUID editorID) | ||
362 | { | ||
363 | foreach (CanEditObjectInventory check in CanEditObjectInventoryCheckFunctions) | ||
364 | { | ||
365 | if (check(objectID, editorID, m_scene) == false) | ||
366 | { | ||
367 | return false; | ||
368 | } | ||
369 | } | ||
370 | return true; | ||
371 | } | ||
372 | |||
373 | #endregion | ||
374 | |||
375 | #region MOVE OBJECT | ||
376 | public delegate bool CanMoveObject(UUID objectID, UUID moverID, Scene scene); | ||
377 | private List<CanMoveObject> CanMoveObjectCheckFunctions = new List<CanMoveObject>(); | ||
378 | |||
379 | public void addCheckMoveObject(CanMoveObject delegateFunc) | ||
380 | { | ||
381 | if (!CanMoveObjectCheckFunctions.Contains(delegateFunc)) | ||
382 | CanMoveObjectCheckFunctions.Add(delegateFunc); | ||
383 | } | ||
384 | |||
385 | public void removeCheckMoveObject(CanMoveObject delegateFunc) | ||
386 | { | ||
387 | if (CanMoveObjectCheckFunctions.Contains(delegateFunc)) | ||
388 | CanMoveObjectCheckFunctions.Remove(delegateFunc); | ||
389 | } | ||
390 | |||
391 | public bool ExternalChecksCanMoveObject(UUID objectID, UUID moverID) | ||
392 | { | ||
393 | foreach (CanMoveObject check in CanMoveObjectCheckFunctions) | ||
394 | { | ||
395 | if (check(objectID,moverID,m_scene) == false) | ||
396 | { | ||
397 | return false; | ||
398 | } | ||
399 | } | ||
400 | return true; | ||
401 | } | ||
402 | |||
403 | #endregion | ||
404 | |||
405 | #region OBJECT ENTRY | ||
406 | public delegate bool CanObjectEntry(UUID objectID, Vector3 newPoint, Scene scene); | ||
407 | private List<CanObjectEntry> CanObjectEntryCheckFunctions = new List<CanObjectEntry>(); | ||
408 | |||
409 | public void addCheckObjectEntry(CanObjectEntry delegateFunc) | ||
410 | { | ||
411 | if (!CanObjectEntryCheckFunctions.Contains(delegateFunc)) | ||
412 | CanObjectEntryCheckFunctions.Add(delegateFunc); | ||
413 | } | ||
414 | |||
415 | public void removeCheckObjectEntry(CanObjectEntry delegateFunc) | ||
416 | { | ||
417 | if (CanObjectEntryCheckFunctions.Contains(delegateFunc)) | ||
418 | CanObjectEntryCheckFunctions.Remove(delegateFunc); | ||
419 | } | ||
420 | |||
421 | public bool ExternalChecksCanObjectEntry(UUID objectID, Vector3 newPoint) | ||
422 | { | ||
423 | foreach (CanObjectEntry check in CanObjectEntryCheckFunctions) | ||
424 | { | ||
425 | if (check(objectID, newPoint, m_scene) == false) | ||
426 | { | ||
427 | return false; | ||
428 | } | ||
429 | } | ||
430 | return true; | ||
431 | } | ||
432 | |||
433 | #endregion | ||
434 | |||
435 | #region RETURN OBJECT | ||
436 | public delegate bool CanReturnObject(UUID objectID, UUID returnerID, Scene scene); | ||
437 | private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>(); | ||
438 | |||
439 | public void addCheckReturnObject(CanReturnObject delegateFunc) | ||
440 | { | ||
441 | if (!CanReturnObjectCheckFunctions.Contains(delegateFunc)) | ||
442 | CanReturnObjectCheckFunctions.Add(delegateFunc); | ||
443 | } | ||
444 | |||
445 | public void removeCheckReturnObject(CanReturnObject delegateFunc) | ||
446 | { | ||
447 | if (CanReturnObjectCheckFunctions.Contains(delegateFunc)) | ||
448 | CanReturnObjectCheckFunctions.Remove(delegateFunc); | ||
449 | } | ||
450 | |||
451 | public bool ExternalChecksCanReturnObject(UUID objectID, UUID returnerID) | ||
452 | { | ||
453 | foreach (CanReturnObject check in CanReturnObjectCheckFunctions) | ||
454 | { | ||
455 | if (check(objectID,returnerID,m_scene) == false) | ||
456 | { | ||
457 | return false; | ||
458 | } | ||
459 | } | ||
460 | return true; | ||
461 | } | ||
462 | |||
463 | #endregion | ||
464 | |||
465 | #region INSTANT MESSAGE | ||
466 | public delegate bool CanInstantMessage(UUID user, UUID target, Scene startScene); | ||
467 | private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>(); | ||
468 | |||
469 | public void addCheckInstantMessage(CanInstantMessage delegateFunc) | ||
470 | { | ||
471 | if (!CanInstantMessageCheckFunctions.Contains(delegateFunc)) | ||
472 | CanInstantMessageCheckFunctions.Add(delegateFunc); | ||
473 | } | ||
474 | |||
475 | public void removeCheckInstantMessage(CanInstantMessage delegateFunc) | ||
476 | { | ||
477 | if (CanInstantMessageCheckFunctions.Contains(delegateFunc)) | ||
478 | CanInstantMessageCheckFunctions.Remove(delegateFunc); | ||
479 | } | ||
480 | |||
481 | public bool ExternalChecksCanInstantMessage(UUID user, UUID target) | ||
482 | { | ||
483 | foreach (CanInstantMessage check in CanInstantMessageCheckFunctions) | ||
484 | { | ||
485 | if (check(user, target, m_scene) == false) | ||
486 | { | ||
487 | return false; | ||
488 | } | ||
489 | } | ||
490 | return true; | ||
491 | } | ||
492 | |||
493 | #endregion | ||
494 | |||
495 | #region INVENTORY TRANSFER | ||
496 | public delegate bool CanInventoryTransfer(UUID user, UUID target, Scene startScene); | ||
497 | private List<CanInventoryTransfer> CanInventoryTransferCheckFunctions = new List<CanInventoryTransfer>(); | ||
498 | |||
499 | public void addCheckInventoryTransfer(CanInventoryTransfer delegateFunc) | ||
500 | { | ||
501 | if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc)) | ||
502 | CanInventoryTransferCheckFunctions.Add(delegateFunc); | ||
503 | } | ||
504 | |||
505 | public void removeCheckInventoryTransfer(CanInventoryTransfer delegateFunc) | ||
506 | { | ||
507 | if (CanInventoryTransferCheckFunctions.Contains(delegateFunc)) | ||
508 | CanInventoryTransferCheckFunctions.Remove(delegateFunc); | ||
509 | } | ||
510 | |||
511 | public bool ExternalChecksCanInventoryTransfer(UUID user, UUID target) | ||
512 | { | ||
513 | foreach (CanInventoryTransfer check in CanInventoryTransferCheckFunctions) | ||
514 | { | ||
515 | if (check(user, target, m_scene) == false) | ||
516 | { | ||
517 | return false; | ||
518 | } | ||
519 | } | ||
520 | return true; | ||
521 | } | ||
522 | |||
523 | #endregion | ||
524 | |||
525 | #region VIEW SCRIPT | ||
526 | public delegate bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene); | ||
527 | private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>(); | ||
528 | |||
529 | public void addCheckViewScript(CanViewScript delegateFunc) | ||
530 | { | ||
531 | if (!CanViewScriptCheckFunctions.Contains(delegateFunc)) | ||
532 | CanViewScriptCheckFunctions.Add(delegateFunc); | ||
533 | } | ||
534 | |||
535 | public void removeCheckViewScript(CanViewScript delegateFunc) | ||
536 | { | ||
537 | if (CanViewScriptCheckFunctions.Contains(delegateFunc)) | ||
538 | CanViewScriptCheckFunctions.Remove(delegateFunc); | ||
539 | } | ||
540 | |||
541 | public bool ExternalChecksCanViewScript(UUID script, UUID objectID, UUID user) | ||
542 | { | ||
543 | foreach (CanViewScript check in CanViewScriptCheckFunctions) | ||
544 | { | ||
545 | if (check(script, objectID, user, m_scene) == false) | ||
546 | { | ||
547 | return false; | ||
548 | } | ||
549 | } | ||
550 | return true; | ||
551 | } | ||
552 | |||
553 | public delegate bool CanViewNotecard(UUID script, UUID objectID, UUID user, Scene scene); | ||
554 | private List<CanViewNotecard> CanViewNotecardCheckFunctions = new List<CanViewNotecard>(); | ||
555 | |||
556 | public void addCheckViewNotecard(CanViewNotecard delegateFunc) | ||
557 | { | ||
558 | if (!CanViewNotecardCheckFunctions.Contains(delegateFunc)) | ||
559 | CanViewNotecardCheckFunctions.Add(delegateFunc); | ||
560 | } | ||
561 | |||
562 | public void removeCheckViewNotecard(CanViewNotecard delegateFunc) | ||
563 | { | ||
564 | if (CanViewNotecardCheckFunctions.Contains(delegateFunc)) | ||
565 | CanViewNotecardCheckFunctions.Remove(delegateFunc); | ||
566 | } | ||
567 | |||
568 | public bool ExternalChecksCanViewNotecard(UUID script, UUID objectID, UUID user) | ||
569 | { | ||
570 | foreach (CanViewNotecard check in CanViewNotecardCheckFunctions) | ||
571 | { | ||
572 | if (check(script, objectID, user, m_scene) == false) | ||
573 | { | ||
574 | return false; | ||
575 | } | ||
576 | } | ||
577 | return true; | ||
578 | } | ||
579 | |||
580 | #endregion | ||
581 | |||
582 | #region EDIT SCRIPT | ||
583 | public delegate bool CanEditScript(UUID script, UUID objectID, UUID user, Scene scene); | ||
584 | private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>(); | ||
585 | |||
586 | public void addCheckEditScript(CanEditScript delegateFunc) | ||
587 | { | ||
588 | if (!CanEditScriptCheckFunctions.Contains(delegateFunc)) | ||
589 | CanEditScriptCheckFunctions.Add(delegateFunc); | ||
590 | } | ||
591 | |||
592 | public void removeCheckEditScript(CanEditScript delegateFunc) | ||
593 | { | ||
594 | if (CanEditScriptCheckFunctions.Contains(delegateFunc)) | ||
595 | CanEditScriptCheckFunctions.Remove(delegateFunc); | ||
596 | } | ||
597 | |||
598 | public bool ExternalChecksCanEditScript(UUID script, UUID objectID, UUID user) | ||
599 | { | ||
600 | foreach (CanEditScript check in CanEditScriptCheckFunctions) | ||
601 | { | ||
602 | if (check(script, objectID, user, m_scene) == false) | ||
603 | { | ||
604 | return false; | ||
605 | } | ||
606 | } | ||
607 | return true; | ||
608 | } | ||
609 | |||
610 | public delegate bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene); | ||
611 | private List<CanEditNotecard> CanEditNotecardCheckFunctions = new List<CanEditNotecard>(); | ||
612 | |||
613 | public void addCheckEditNotecard(CanEditNotecard delegateFunc) | ||
614 | { | ||
615 | if (!CanEditNotecardCheckFunctions.Contains(delegateFunc)) | ||
616 | CanEditNotecardCheckFunctions.Add(delegateFunc); | ||
617 | } | ||
618 | |||
619 | public void removeCheckEditNotecard(CanEditNotecard delegateFunc) | ||
620 | { | ||
621 | if (CanEditNotecardCheckFunctions.Contains(delegateFunc)) | ||
622 | CanEditNotecardCheckFunctions.Remove(delegateFunc); | ||
623 | } | ||
624 | |||
625 | public bool ExternalChecksCanEditNotecard(UUID script, UUID objectID, UUID user) | ||
626 | { | ||
627 | foreach (CanEditNotecard check in CanEditNotecardCheckFunctions) | ||
628 | { | ||
629 | if (check(script, objectID, user, m_scene) == false) | ||
630 | { | ||
631 | return false; | ||
632 | } | ||
633 | } | ||
634 | return true; | ||
635 | } | ||
636 | |||
637 | #endregion | ||
638 | |||
639 | #region RUN SCRIPT (When Script Placed in Object) | ||
640 | public delegate bool CanRunScript(UUID script, UUID objectID, UUID user, Scene scene); | ||
641 | private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>(); | ||
642 | |||
643 | public void addCheckRunScript(CanRunScript delegateFunc) | ||
644 | { | ||
645 | if (!CanRunScriptCheckFunctions.Contains(delegateFunc)) | ||
646 | CanRunScriptCheckFunctions.Add(delegateFunc); | ||
647 | } | ||
648 | |||
649 | public void removeCheckRunScript(CanRunScript delegateFunc) | ||
650 | { | ||
651 | if (CanRunScriptCheckFunctions.Contains(delegateFunc)) | ||
652 | CanRunScriptCheckFunctions.Remove(delegateFunc); | ||
653 | } | ||
654 | |||
655 | public bool ExternalChecksCanRunScript(UUID script, UUID objectID, UUID user) | ||
656 | { | ||
657 | foreach (CanRunScript check in CanRunScriptCheckFunctions) | ||
658 | { | ||
659 | if (check(script, objectID, user, m_scene) == false) | ||
660 | { | ||
661 | return false; | ||
662 | } | ||
663 | } | ||
664 | return true; | ||
665 | } | ||
666 | |||
667 | #endregion | ||
668 | |||
669 | #region START SCRIPT (When Script run box is Checked after placed in object) | ||
670 | public delegate bool CanStartScript(UUID script, UUID user, Scene scene); | ||
671 | private List<CanStartScript> CanStartScriptCheckFunctions = new List<CanStartScript>(); | ||
672 | |||
673 | public void addCheckStartScript(CanStartScript delegateFunc) | ||
674 | { | ||
675 | if (!CanStartScriptCheckFunctions.Contains(delegateFunc)) | ||
676 | CanStartScriptCheckFunctions.Add(delegateFunc); | ||
677 | } | ||
678 | |||
679 | public void removeCheckStartScript(CanStartScript delegateFunc) | ||
680 | { | ||
681 | if (CanStartScriptCheckFunctions.Contains(delegateFunc)) | ||
682 | CanStartScriptCheckFunctions.Remove(delegateFunc); | ||
683 | } | ||
684 | |||
685 | public bool ExternalChecksCanStartScript(UUID script, UUID user) | ||
686 | { | ||
687 | foreach (CanStartScript check in CanStartScriptCheckFunctions) | ||
688 | { | ||
689 | if (check(script, user, m_scene) == false) | ||
690 | { | ||
691 | return false; | ||
692 | } | ||
693 | } | ||
694 | return true; | ||
695 | } | ||
696 | |||
697 | #endregion | ||
698 | |||
699 | #region STOP SCRIPT (When Script run box is unchecked after placed in object) | ||
700 | public delegate bool CanStopScript(UUID script, UUID user, Scene scene); | ||
701 | private List<CanStopScript> CanStopScriptCheckFunctions = new List<CanStopScript>(); | ||
702 | |||
703 | public void addCheckStopScript(CanStopScript delegateFunc) | ||
704 | { | ||
705 | if (!CanStopScriptCheckFunctions.Contains(delegateFunc)) | ||
706 | CanStopScriptCheckFunctions.Add(delegateFunc); | ||
707 | } | ||
708 | |||
709 | public void removeCheckStopScript(CanStopScript delegateFunc) | ||
710 | { | ||
711 | if (CanStopScriptCheckFunctions.Contains(delegateFunc)) | ||
712 | CanStopScriptCheckFunctions.Remove(delegateFunc); | ||
713 | } | ||
714 | |||
715 | public bool ExternalChecksCanStopScript(UUID script, UUID user) | ||
716 | { | ||
717 | foreach (CanStopScript check in CanStopScriptCheckFunctions) | ||
718 | { | ||
719 | if (check(script, user, m_scene) == false) | ||
720 | { | ||
721 | return false; | ||
722 | } | ||
723 | } | ||
724 | return true; | ||
725 | } | ||
726 | |||
727 | #endregion | ||
728 | |||
729 | #region RESET SCRIPT | ||
730 | public delegate bool CanResetScript(UUID script, UUID user, Scene scene); | ||
731 | private List<CanResetScript> CanResetScriptCheckFunctions = new List<CanResetScript>(); | ||
732 | |||
733 | public void addCheckResetScript(CanResetScript delegateFunc) | ||
734 | { | ||
735 | if (!CanResetScriptCheckFunctions.Contains(delegateFunc)) | ||
736 | CanResetScriptCheckFunctions.Add(delegateFunc); | ||
737 | } | ||
738 | |||
739 | public void removeCheckResetScript(CanResetScript delegateFunc) | ||
740 | { | ||
741 | if (CanResetScriptCheckFunctions.Contains(delegateFunc)) | ||
742 | CanResetScriptCheckFunctions.Remove(delegateFunc); | ||
743 | } | ||
744 | |||
745 | public bool ExternalChecksCanResetScript(UUID script, UUID user) | ||
746 | { | ||
747 | foreach (CanResetScript check in CanResetScriptCheckFunctions) | ||
748 | { | ||
749 | if (check(script, user, m_scene) == false) | ||
750 | { | ||
751 | return false; | ||
752 | } | ||
753 | } | ||
754 | return true; | ||
755 | } | ||
756 | |||
757 | #endregion | ||
758 | |||
759 | #region TERRAFORM LAND | ||
760 | public delegate bool CanTerraformLand(UUID user, Vector3 position, Scene requestFromScene); | ||
761 | private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>(); | ||
762 | |||
763 | public void addCheckTerraformLand(CanTerraformLand delegateFunc) | ||
764 | { | ||
765 | if (!CanTerraformLandCheckFunctions.Contains(delegateFunc)) | ||
766 | CanTerraformLandCheckFunctions.Add(delegateFunc); | ||
767 | } | ||
768 | |||
769 | public void removeCheckTerraformLand(CanTerraformLand delegateFunc) | ||
770 | { | ||
771 | if (CanTerraformLandCheckFunctions.Contains(delegateFunc)) | ||
772 | CanTerraformLandCheckFunctions.Remove(delegateFunc); | ||
773 | } | ||
774 | |||
775 | public bool ExternalChecksCanTerraformLand(UUID user, Vector3 pos) | ||
776 | { | ||
777 | foreach (CanTerraformLand check in CanTerraformLandCheckFunctions) | ||
778 | { | ||
779 | if (check(user, pos, m_scene) == false) | ||
780 | { | ||
781 | return false; | ||
782 | } | ||
783 | } | ||
784 | return true; | ||
785 | } | ||
786 | |||
787 | #endregion | ||
788 | |||
789 | #region RUN CONSOLE COMMAND | ||
790 | public delegate bool CanRunConsoleCommand(UUID user, Scene requestFromScene); | ||
791 | private List<CanRunConsoleCommand> CanRunConsoleCommandCheckFunctions = new List<CanRunConsoleCommand>(); | ||
792 | |||
793 | public void addCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc) | ||
794 | { | ||
795 | if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc)) | ||
796 | CanRunConsoleCommandCheckFunctions.Add(delegateFunc); | ||
797 | } | ||
798 | |||
799 | public void removeCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc) | ||
800 | { | ||
801 | if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc)) | ||
802 | CanRunConsoleCommandCheckFunctions.Remove(delegateFunc); | ||
803 | } | ||
804 | |||
805 | public bool ExternalChecksCanRunConsoleCommand(UUID user) | ||
806 | { | ||
807 | foreach (CanRunConsoleCommand check in CanRunConsoleCommandCheckFunctions) | ||
808 | { | ||
809 | if (check(user, m_scene) == false) | ||
810 | { | ||
811 | return false; | ||
812 | } | ||
813 | } | ||
814 | return true; | ||
815 | } | ||
816 | |||
817 | #endregion | ||
818 | |||
819 | #region CAN ISSUE ESTATE COMMAND | ||
820 | public delegate bool CanIssueEstateCommand(UUID user, Scene requestFromScene, bool ownerCommand); | ||
821 | private List<CanIssueEstateCommand> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommand>(); | ||
822 | |||
823 | public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc) | ||
824 | { | ||
825 | if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc)) | ||
826 | CanIssueEstateCommandCheckFunctions.Add(delegateFunc); | ||
827 | } | ||
828 | |||
829 | public void removeCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc) | ||
830 | { | ||
831 | if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc)) | ||
832 | CanIssueEstateCommandCheckFunctions.Remove(delegateFunc); | ||
833 | } | ||
834 | |||
835 | public bool ExternalChecksCanIssueEstateCommand(UUID user, bool ownerCommand) | ||
836 | { | ||
837 | foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions) | ||
838 | { | ||
839 | if (check(user, m_scene, ownerCommand) == false) | ||
840 | { | ||
841 | return false; | ||
842 | } | ||
843 | } | ||
844 | return true; | ||
845 | } | ||
846 | #endregion | ||
847 | |||
848 | #region CAN BE GODLIKE | ||
849 | public delegate bool CanBeGodLike(UUID user, Scene requestFromScene); | ||
850 | private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>(); | ||
851 | |||
852 | public void addCheckBeGodLike(CanBeGodLike delegateFunc) | ||
853 | { | ||
854 | if (!CanBeGodLikeCheckFunctions.Contains(delegateFunc)) | ||
855 | CanBeGodLikeCheckFunctions.Add(delegateFunc); | ||
856 | } | ||
857 | |||
858 | public void removeCheckBeGodLike(CanBeGodLike delegateFunc) | ||
859 | { | ||
860 | if (CanBeGodLikeCheckFunctions.Contains(delegateFunc)) | ||
861 | CanBeGodLikeCheckFunctions.Remove(delegateFunc); | ||
862 | } | ||
863 | |||
864 | public bool ExternalChecksCanBeGodLike(UUID user) | ||
865 | { | ||
866 | foreach (CanBeGodLike check in CanBeGodLikeCheckFunctions) | ||
867 | { | ||
868 | if (check(user, m_scene) == false) | ||
869 | { | ||
870 | return false; | ||
871 | } | ||
872 | } | ||
873 | return true; | ||
874 | } | ||
875 | #endregion | ||
876 | |||
877 | #region EDIT PARCEL | ||
878 | public delegate bool CanEditParcel(UUID user, ILandObject parcel, Scene scene); | ||
879 | private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>(); | ||
880 | |||
881 | public void addCheckEditParcel(CanEditParcel delegateFunc) | ||
882 | { | ||
883 | if (!CanEditParcelCheckFunctions.Contains(delegateFunc)) | ||
884 | CanEditParcelCheckFunctions.Add(delegateFunc); | ||
885 | } | ||
886 | |||
887 | public void removeCheckEditParcel(CanEditParcel delegateFunc) | ||
888 | { | ||
889 | if (CanEditParcelCheckFunctions.Contains(delegateFunc)) | ||
890 | CanEditParcelCheckFunctions.Remove(delegateFunc); | ||
891 | } | ||
892 | |||
893 | public bool ExternalChecksCanEditParcel(UUID user, ILandObject parcel) | ||
894 | { | ||
895 | foreach (CanEditParcel check in CanEditParcelCheckFunctions) | ||
896 | { | ||
897 | if (check(user, parcel, m_scene) == false) | ||
898 | { | ||
899 | return false; | ||
900 | } | ||
901 | } | ||
902 | return true; | ||
903 | } | ||
904 | #endregion | ||
905 | |||
906 | #region SELL PARCEL | ||
907 | public delegate bool CanSellParcel(UUID user, ILandObject parcel, Scene scene); | ||
908 | private List<CanSellParcel> CanSellParcelCheckFunctions = new List<CanSellParcel>(); | ||
909 | |||
910 | public void addCheckSellParcel(CanSellParcel delegateFunc) | ||
911 | { | ||
912 | if (!CanSellParcelCheckFunctions.Contains(delegateFunc)) | ||
913 | CanSellParcelCheckFunctions.Add(delegateFunc); | ||
914 | } | ||
915 | |||
916 | public void removeCheckSellParcel(CanSellParcel delegateFunc) | ||
917 | { | ||
918 | if (CanSellParcelCheckFunctions.Contains(delegateFunc)) | ||
919 | CanSellParcelCheckFunctions.Remove(delegateFunc); | ||
920 | } | ||
921 | |||
922 | public bool ExternalChecksCanSellParcel(UUID user, ILandObject parcel) | ||
923 | { | ||
924 | foreach (CanSellParcel check in CanSellParcelCheckFunctions) | ||
925 | { | ||
926 | if (check(user, parcel, m_scene) == false) | ||
927 | { | ||
928 | return false; | ||
929 | } | ||
930 | } | ||
931 | return true; | ||
932 | } | ||
933 | #endregion | ||
934 | |||
935 | #region ABANDON PARCEL | ||
936 | public delegate bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene); | ||
937 | private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>(); | ||
938 | |||
939 | public void addCheckAbandonParcel(CanAbandonParcel delegateFunc) | ||
940 | { | ||
941 | if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) | ||
942 | CanAbandonParcelCheckFunctions.Add(delegateFunc); | ||
943 | } | ||
944 | |||
945 | public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc) | ||
946 | { | ||
947 | if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) | ||
948 | CanAbandonParcelCheckFunctions.Remove(delegateFunc); | ||
949 | } | ||
950 | |||
951 | public bool ExternalChecksCanAbandonParcel(UUID user, ILandObject parcel) | ||
952 | { | ||
953 | foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) | ||
954 | { | ||
955 | if (check(user, parcel, m_scene) == false) | ||
956 | { | ||
957 | return false; | ||
958 | } | ||
959 | } | ||
960 | return true; | ||
961 | } | ||
962 | #endregion | ||
963 | |||
964 | public delegate bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene); | ||
965 | private List<CanReclaimParcel> CanReclaimParcelCheckFunctions = new List<CanReclaimParcel>(); | ||
966 | |||
967 | public void addCheckReclaimParcel(CanReclaimParcel delegateFunc) | ||
968 | { | ||
969 | if (!CanReclaimParcelCheckFunctions.Contains(delegateFunc)) | ||
970 | CanReclaimParcelCheckFunctions.Add(delegateFunc); | ||
971 | } | ||
972 | |||
973 | public void removeCheckReclaimParcel(CanReclaimParcel delegateFunc) | ||
974 | { | ||
975 | if (CanReclaimParcelCheckFunctions.Contains(delegateFunc)) | ||
976 | CanReclaimParcelCheckFunctions.Remove(delegateFunc); | ||
977 | } | ||
978 | |||
979 | public bool ExternalChecksCanReclaimParcel(UUID user, ILandObject parcel) | ||
980 | { | ||
981 | foreach (CanReclaimParcel check in CanReclaimParcelCheckFunctions) | ||
982 | { | ||
983 | if (check(user, parcel, m_scene) == false) | ||
984 | { | ||
985 | return false; | ||
986 | } | ||
987 | } | ||
988 | return true; | ||
989 | } | ||
990 | public delegate bool CanBuyLand(UUID user, ILandObject parcel, Scene scene); | ||
991 | private List<CanBuyLand> CanBuyLandCheckFunctions = new List<CanBuyLand>(); | ||
992 | |||
993 | public void addCheckCanBuyLand(CanBuyLand delegateFunc) | ||
994 | { | ||
995 | if (!CanBuyLandCheckFunctions.Contains(delegateFunc)) | ||
996 | CanBuyLandCheckFunctions.Add(delegateFunc); | ||
997 | } | ||
998 | |||
999 | public void removeCheckCanBuyLand(CanBuyLand delegateFunc) | ||
1000 | { | ||
1001 | if (CanBuyLandCheckFunctions.Contains(delegateFunc)) | ||
1002 | CanBuyLandCheckFunctions.Remove(delegateFunc); | ||
1003 | } | ||
1004 | |||
1005 | public bool ExternalChecksCanBuyLand(UUID user, ILandObject parcel) | ||
1006 | { | ||
1007 | foreach (CanBuyLand check in CanBuyLandCheckFunctions) | ||
1008 | { | ||
1009 | if (check(user, parcel, m_scene) == false) | ||
1010 | { | ||
1011 | return false; | ||
1012 | } | ||
1013 | } | ||
1014 | return true; | ||
1015 | } | ||
1016 | |||
1017 | public delegate bool CanLinkObject(UUID user, UUID objectID); | ||
1018 | private List<CanLinkObject> CanLinkObjectCheckFunctions = new List<CanLinkObject>(); | ||
1019 | |||
1020 | public void addCheckCanLinkObject(CanLinkObject delegateFunc) | ||
1021 | { | ||
1022 | if (!CanLinkObjectCheckFunctions.Contains(delegateFunc)) | ||
1023 | CanLinkObjectCheckFunctions.Add(delegateFunc); | ||
1024 | } | ||
1025 | |||
1026 | public void removeCheckCanLinkObject(CanLinkObject delegateFunc) | ||
1027 | { | ||
1028 | if (CanLinkObjectCheckFunctions.Contains(delegateFunc)) | ||
1029 | CanLinkObjectCheckFunctions.Remove(delegateFunc); | ||
1030 | } | ||
1031 | |||
1032 | public bool ExternalChecksCanLinkObject(UUID user, UUID objectID) | ||
1033 | { | ||
1034 | foreach (CanLinkObject check in CanLinkObjectCheckFunctions) | ||
1035 | { | ||
1036 | if (check(user, objectID) == false) | ||
1037 | { | ||
1038 | return false; | ||
1039 | } | ||
1040 | } | ||
1041 | return true; | ||
1042 | } | ||
1043 | |||
1044 | public delegate bool CanDelinkObject(UUID user, UUID objectID); | ||
1045 | private List<CanDelinkObject> CanDelinkObjectCheckFunctions = new List<CanDelinkObject>(); | ||
1046 | |||
1047 | public void addCheckCanDelinkObject(CanDelinkObject delegateFunc) | ||
1048 | { | ||
1049 | if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc)) | ||
1050 | CanDelinkObjectCheckFunctions.Add(delegateFunc); | ||
1051 | } | ||
1052 | |||
1053 | public void removeCheckCanDelinkObject(CanDelinkObject delegateFunc) | ||
1054 | { | ||
1055 | if (CanDelinkObjectCheckFunctions.Contains(delegateFunc)) | ||
1056 | CanDelinkObjectCheckFunctions.Remove(delegateFunc); | ||
1057 | } | ||
1058 | |||
1059 | public bool ExternalChecksCanDelinkObject(UUID user, UUID objectID) | ||
1060 | { | ||
1061 | foreach (CanDelinkObject check in CanDelinkObjectCheckFunctions) | ||
1062 | { | ||
1063 | if (check(user, objectID) == false) | ||
1064 | { | ||
1065 | return false; | ||
1066 | } | ||
1067 | } | ||
1068 | return true; | ||
1069 | } | ||
1070 | |||
1071 | #endregion | ||
1072 | |||
1073 | public delegate bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID); | ||
1074 | private List<CanCreateObjectInventory> CanCreateObjectInventoryCheckFunctions | ||
1075 | = new List<CanCreateObjectInventory>(); | ||
1076 | |||
1077 | |||
1078 | public void addCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc) | ||
1079 | { | ||
1080 | if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) | ||
1081 | CanCreateObjectInventoryCheckFunctions.Add(delegateFunc); | ||
1082 | } | ||
1083 | |||
1084 | public void removeCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc) | ||
1085 | { | ||
1086 | if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) | ||
1087 | CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc); | ||
1088 | } | ||
1089 | |||
1090 | /// <summary> | ||
1091 | /// Check whether the specified user is allowed to directly create the given inventory type in a prim's | ||
1092 | /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). | ||
1093 | /// </summary> | ||
1094 | /// <param name="invType"></param> | ||
1095 | /// <param name="objectID"></param> | ||
1096 | /// <param name="userID"></param> | ||
1097 | /// <returns></returns> | ||
1098 | public bool ExternalChecksCanCreateObjectInventory(int invType, UUID objectID, UUID userID) | ||
1099 | { | ||
1100 | foreach (CanCreateObjectInventory check in CanCreateObjectInventoryCheckFunctions) | ||
1101 | { | ||
1102 | if (check(invType, objectID, userID) == false) | ||
1103 | { | ||
1104 | return false; | ||
1105 | } | ||
1106 | } | ||
1107 | |||
1108 | return true; | ||
1109 | } | ||
1110 | |||
1111 | public delegate bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID); | ||
1112 | private List<CanCopyObjectInventory> CanCopyObjectInventoryCheckFunctions = new List<CanCopyObjectInventory>(); | ||
1113 | |||
1114 | public void addCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc) | ||
1115 | { | ||
1116 | if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) | ||
1117 | CanCopyObjectInventoryCheckFunctions.Add(delegateFunc); | ||
1118 | } | ||
1119 | |||
1120 | public void removeCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc) | ||
1121 | { | ||
1122 | if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) | ||
1123 | CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc); | ||
1124 | } | ||
1125 | |||
1126 | public bool ExternalChecksCanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID) | ||
1127 | { | ||
1128 | foreach (CanCopyObjectInventory check in CanCopyObjectInventoryCheckFunctions) | ||
1129 | { | ||
1130 | if (check(itemID, objectID, userID) == false) | ||
1131 | { | ||
1132 | return false; | ||
1133 | } | ||
1134 | } | ||
1135 | return true; | ||
1136 | } | ||
1137 | |||
1138 | public delegate bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID); | ||
1139 | private List<CanDeleteObjectInventory> CanDeleteObjectInventoryCheckFunctions | ||
1140 | = new List<CanDeleteObjectInventory>(); | ||
1141 | |||
1142 | public void addCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc) | ||
1143 | { | ||
1144 | if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) | ||
1145 | CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc); | ||
1146 | } | ||
1147 | |||
1148 | public void removeCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc) | ||
1149 | { | ||
1150 | if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) | ||
1151 | CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc); | ||
1152 | } | ||
1153 | |||
1154 | public bool ExternalChecksCanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) | ||
1155 | { | ||
1156 | foreach (CanDeleteObjectInventory check in CanDeleteObjectInventoryCheckFunctions) | ||
1157 | { | ||
1158 | if (check(itemID, objectID, userID) == false) | ||
1159 | { | ||
1160 | return false; | ||
1161 | } | ||
1162 | } | ||
1163 | |||
1164 | return true; | ||
1165 | } | ||
1166 | |||
1167 | public delegate bool CanCreateUserInventory(int invType, UUID userID); | ||
1168 | private List<CanCreateUserInventory> CanCreateUserInventoryCheckFunctions | ||
1169 | = new List<CanCreateUserInventory>(); | ||
1170 | |||
1171 | public void addCheckCanCreateUserInventory(CanCreateUserInventory delegateFunc) | ||
1172 | { | ||
1173 | if (!CanCreateUserInventoryCheckFunctions.Contains(delegateFunc)) | ||
1174 | CanCreateUserInventoryCheckFunctions.Add(delegateFunc); | ||
1175 | } | ||
1176 | |||
1177 | public void removeCheckCanCreateUserInventory(CanCreateUserInventory delegateFunc) | ||
1178 | { | ||
1179 | if (CanCreateUserInventoryCheckFunctions.Contains(delegateFunc)) | ||
1180 | CanCreateUserInventoryCheckFunctions.Remove(delegateFunc); | ||
1181 | } | ||
1182 | |||
1183 | /// <summary> | ||
1184 | /// Check whether the specified user is allowed to create the given inventory type in their inventory. | ||
1185 | /// </summary> | ||
1186 | /// <param name="invType"></param> | ||
1187 | /// <param name="userID"></param> | ||
1188 | /// <returns></returns> | ||
1189 | public bool ExternalChecksCanCreateUserInventory(int invType, UUID userID) | ||
1190 | { | ||
1191 | foreach (CanCreateUserInventory check in CanCreateUserInventoryCheckFunctions) | ||
1192 | { | ||
1193 | if (check(invType, userID) == false) | ||
1194 | { | ||
1195 | return false; | ||
1196 | } | ||
1197 | } | ||
1198 | |||
1199 | return true; | ||
1200 | } | ||
1201 | |||
1202 | public delegate bool CanEditUserInventory(UUID itemID, UUID userID); | ||
1203 | private List<CanEditUserInventory> CanEditUserInventoryCheckFunctions | ||
1204 | = new List<CanEditUserInventory>(); | ||
1205 | |||
1206 | public void addCheckCanEditUserInventory(CanEditUserInventory delegateFunc) | ||
1207 | { | ||
1208 | if (!CanEditUserInventoryCheckFunctions.Contains(delegateFunc)) | ||
1209 | CanEditUserInventoryCheckFunctions.Add(delegateFunc); | ||
1210 | } | ||
1211 | |||
1212 | public void removeCheckCanEditUserInventory(CanEditUserInventory delegateFunc) | ||
1213 | { | ||
1214 | if (CanEditUserInventoryCheckFunctions.Contains(delegateFunc)) | ||
1215 | CanEditUserInventoryCheckFunctions.Remove(delegateFunc); | ||
1216 | } | ||
1217 | |||
1218 | /// <summary> | ||
1219 | /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. | ||
1220 | /// </summary> | ||
1221 | /// <param name="itemID"></param> | ||
1222 | /// <param name="userID"></param> | ||
1223 | /// <returns></returns> | ||
1224 | public bool ExternalChecksCanEditUserInventory(UUID itemID, UUID userID) | ||
1225 | { | ||
1226 | foreach (CanEditUserInventory check in CanEditUserInventoryCheckFunctions) | ||
1227 | { | ||
1228 | if (check(itemID, userID) == false) | ||
1229 | { | ||
1230 | return false; | ||
1231 | } | ||
1232 | } | ||
1233 | |||
1234 | return true; | ||
1235 | } | ||
1236 | |||
1237 | public delegate bool CanCopyUserInventory(UUID itemID, UUID userID); | ||
1238 | private List<CanCopyUserInventory> CanCopyUserInventoryCheckFunctions | ||
1239 | = new List<CanCopyUserInventory>(); | ||
1240 | |||
1241 | public void addCheckCanCopyUserInventory(CanCopyUserInventory delegateFunc) | ||
1242 | { | ||
1243 | if (!CanCopyUserInventoryCheckFunctions.Contains(delegateFunc)) | ||
1244 | CanCopyUserInventoryCheckFunctions.Add(delegateFunc); | ||
1245 | } | ||
1246 | |||
1247 | public void removeCheckCanCopyUserInventory(CanCopyUserInventory delegateFunc) | ||
1248 | { | ||
1249 | if (CanCopyUserInventoryCheckFunctions.Contains(delegateFunc)) | ||
1250 | CanCopyUserInventoryCheckFunctions.Remove(delegateFunc); | ||
1251 | } | ||
1252 | |||
1253 | /// <summary> | ||
1254 | /// Check whether the specified user is allowed to copy the given inventory item from their own inventory. | ||
1255 | /// </summary> | ||
1256 | /// <param name="itemID"></param> | ||
1257 | /// <param name="userID"></param> | ||
1258 | /// <returns></returns> | ||
1259 | public bool ExternalChecksCanCopyUserInventory(UUID itemID, UUID userID) | ||
1260 | { | ||
1261 | foreach (CanCopyUserInventory check in CanCopyUserInventoryCheckFunctions) | ||
1262 | { | ||
1263 | if (check(itemID, userID) == false) | ||
1264 | { | ||
1265 | return false; | ||
1266 | } | ||
1267 | } | ||
1268 | |||
1269 | return true; | ||
1270 | } | ||
1271 | |||
1272 | public delegate bool CanDeleteUserInventory(UUID itemID, UUID userID); | ||
1273 | private List<CanDeleteUserInventory> CanDeleteUserInventoryCheckFunctions | ||
1274 | = new List<CanDeleteUserInventory>(); | ||
1275 | |||
1276 | public void addCheckCanDeleteUserInventory(CanDeleteUserInventory delegateFunc) | ||
1277 | { | ||
1278 | if (!CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc)) | ||
1279 | CanDeleteUserInventoryCheckFunctions.Add(delegateFunc); | ||
1280 | } | ||
1281 | |||
1282 | public void removeCheckCanDeleteUserInventory(CanDeleteUserInventory delegateFunc) | ||
1283 | { | ||
1284 | if (CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc)) | ||
1285 | CanDeleteUserInventoryCheckFunctions.Remove(delegateFunc); | ||
1286 | } | ||
1287 | |||
1288 | /// <summary> | ||
1289 | /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. | ||
1290 | /// </summary> | ||
1291 | /// <param name="itemID"></param> | ||
1292 | /// <param name="userID"></param> | ||
1293 | /// <returns></returns> | ||
1294 | public bool ExternalChecksCanDeleteUserInventory(UUID itemID, UUID userID) | ||
1295 | { | ||
1296 | foreach (CanDeleteUserInventory check in CanDeleteUserInventoryCheckFunctions) | ||
1297 | { | ||
1298 | if (check(itemID, userID) == false) | ||
1299 | { | ||
1300 | return false; | ||
1301 | } | ||
1302 | } | ||
1303 | |||
1304 | return true; | ||
1305 | } | ||
1306 | |||
1307 | public delegate bool CanTeleport(UUID userID); | ||
1308 | private List<CanTeleport> CanTeleportCheckFunctions = new List<CanTeleport>(); | ||
1309 | |||
1310 | public void addCheckCanTeleport(CanTeleport delegateFunc) | ||
1311 | { | ||
1312 | if (!CanTeleportCheckFunctions.Contains(delegateFunc)) | ||
1313 | CanTeleportCheckFunctions.Add(delegateFunc); | ||
1314 | } | ||
1315 | |||
1316 | public void removeCheckCanTeleport(CanTeleport delegateFunc) | ||
1317 | { | ||
1318 | if (CanTeleportCheckFunctions.Contains(delegateFunc)) | ||
1319 | CanTeleportCheckFunctions.Remove(delegateFunc); | ||
1320 | } | ||
1321 | |||
1322 | public bool ExternalChecksCanTeleport(UUID userID) | ||
1323 | { | ||
1324 | foreach (CanTeleport check in CanTeleportCheckFunctions) | ||
1325 | { | ||
1326 | if (check(userID) == false) | ||
1327 | { | ||
1328 | return false; | ||
1329 | } | ||
1330 | } | ||
1331 | return true; | ||
1332 | } | ||
1333 | } | ||
1334 | } | ||