Scene.Permissions.cs 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360
  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 OpenSimulator 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. using System;
  28. using System.Collections.Generic;
  29. using System.Reflection;
  30. using System.Text;
  31. using log4net;
  32. using OpenMetaverse;
  33. using OpenSim.Framework;
  34. using OpenSim.Region.Framework.Interfaces;
  35. namespace OpenSim.Region.Framework.Scenes
  36. {
  37. #region Delegates
  38. public delegate uint GenerateClientFlagsHandler(SceneObjectPart part, ScenePresence sp, uint curEffectivePerms);
  39. public delegate void SetBypassPermissionsHandler(bool value);
  40. public delegate bool BypassPermissionsHandler();
  41. public delegate bool PropagatePermissionsHandler();
  42. public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition);
  43. public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter);
  44. public delegate bool DeleteObjectHandler(SceneObjectGroup sog, ScenePresence sp);
  45. public delegate bool TransferObjectHandler(UUID objectID, UUID recipient);
  46. public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
  47. public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID);
  48. public delegate bool SellObjectHandlerByUserID(SceneObjectGroup sog, UUID userID, byte saleType);
  49. public delegate bool SellObjectHandler(SceneObjectGroup sog, ScenePresence sp, byte saleType);
  50. public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
  51. public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
  52. public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
  53. public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
  54. public delegate bool EditObjectPermsHandler(SceneObjectGroup sog, UUID editorID);
  55. public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
  56. public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
  57. public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
  58. public delegate bool ObjectEnterWithScriptsHandler(SceneObjectGroup sog, ILandObject land);
  59. public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects);
  60. public delegate bool InstantMessageHandler(UUID user, UUID target);
  61. public delegate bool InventoryTransferHandler(UUID user, UUID target);
  62. public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
  63. public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user);
  64. public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user);
  65. public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user);
  66. public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user);
  67. public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part);
  68. public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType);
  69. public delegate bool StartScriptHandler(UUID script, UUID user);
  70. public delegate bool StopScriptHandler(UUID script, UUID user);
  71. public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user);
  72. public delegate bool TerraformLandHandler(UUID user, Vector3 position);
  73. public delegate bool RunConsoleCommandHandler(UUID user);
  74. public delegate bool IssueEstateCommandHandler(UUID user, bool ownerCommand);
  75. public delegate bool IsGodHandler(UUID user);
  76. public delegate bool IsGridGodHandler(UUID user);
  77. public delegate bool IsAdministratorHandler(UUID user);
  78. public delegate bool IsEstateManagerHandler(UUID user);
  79. public delegate bool EditParcelHandler(UUID user, ILandObject parcel);
  80. public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, bool allowManager);
  81. public delegate bool SellParcelHandler(UUID user, ILandObject parcel);
  82. public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel);
  83. public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel);
  84. public delegate bool DeedParcelHandler(UUID user, ILandObject parcel);
  85. public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID);
  86. public delegate bool BuyLandHandler(UUID user, ILandObject parcel);
  87. public delegate bool LinkObjectHandler(UUID user, UUID objectID);
  88. public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
  89. public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
  90. public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
  91. public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart);
  92. public delegate bool DoDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart);
  93. public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
  94. public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
  95. public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
  96. public delegate bool EditUserInventoryHandler(UUID itemID, UUID userID);
  97. public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID);
  98. public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
  99. public delegate bool TransferUserInventoryHandler(UUID itemID, UUID userID, UUID recipientID);
  100. public delegate bool TeleportHandler(UUID userID, Scene scene);
  101. public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face);
  102. public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face);
  103. #endregion
  104. public class ScenePermissions
  105. {
  106. // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  107. private Scene m_scene;
  108. public ScenePermissions(Scene scene)
  109. {
  110. m_scene = scene;
  111. }
  112. #region Events
  113. public event GenerateClientFlagsHandler OnGenerateClientFlags;
  114. public event SetBypassPermissionsHandler OnSetBypassPermissions;
  115. public event BypassPermissionsHandler OnBypassPermissions;
  116. public event PropagatePermissionsHandler OnPropagatePermissions;
  117. public event RezObjectHandler OnRezObject;
  118. public event DeleteObjectHandlerByIDs OnDeleteObjectByIDs;
  119. public event DeleteObjectHandler OnDeleteObject;
  120. public event TransferObjectHandler OnTransferObject;
  121. public event TakeObjectHandler OnTakeObject;
  122. public event SellGroupObjectHandler OnSellGroupObject;
  123. public event SellObjectHandlerByUserID OnSellObjectByUserID;
  124. public event SellObjectHandler OnSellObject;
  125. public event TakeCopyObjectHandler OnTakeCopyObject;
  126. public event DuplicateObjectHandler OnDuplicateObject;
  127. public event EditObjectByIDsHandler OnEditObjectByIDs;
  128. public event EditObjectHandler OnEditObject;
  129. public event EditObjectPermsHandler OnEditObjectPerms;
  130. public event EditObjectInventoryHandler OnEditObjectInventory;
  131. public event MoveObjectHandler OnMoveObject;
  132. public event ObjectEntryHandler OnObjectEntry;
  133. public event ObjectEnterWithScriptsHandler OnObjectEnterWithScripts;
  134. public event ReturnObjectsHandler OnReturnObjects;
  135. public event InstantMessageHandler OnInstantMessage;
  136. public event InventoryTransferHandler OnInventoryTransfer;
  137. public event ViewScriptHandler OnViewScript;
  138. public event ViewNotecardHandler OnViewNotecard;
  139. public event EditScriptHandler OnEditScript;
  140. public event EditNotecardHandler OnEditNotecard;
  141. public event RunScriptHandlerByIDs OnRunScriptByIDs;
  142. public event RunScriptHandler OnRunScript;
  143. public event CompileScriptHandler OnCompileScript;
  144. public event StartScriptHandler OnStartScript;
  145. public event StopScriptHandler OnStopScript;
  146. public event ResetScriptHandler OnResetScript;
  147. public event TerraformLandHandler OnTerraformLand;
  148. public event RunConsoleCommandHandler OnRunConsoleCommand;
  149. public event IssueEstateCommandHandler OnIssueEstateCommand;
  150. public event IsGridGodHandler OnIsGridGod;
  151. public event IsAdministratorHandler OnIsAdministrator;
  152. public event IsEstateManagerHandler OnIsEstateManager;
  153. // public event EditParcelHandler OnEditParcel;
  154. public event EditParcelPropertiesHandler OnEditParcelProperties;
  155. public event SellParcelHandler OnSellParcel;
  156. public event AbandonParcelHandler OnAbandonParcel;
  157. public event ReclaimParcelHandler OnReclaimParcel;
  158. public event DeedParcelHandler OnDeedParcel;
  159. public event DeedObjectHandler OnDeedObject;
  160. public event BuyLandHandler OnBuyLand;
  161. public event LinkObjectHandler OnLinkObject;
  162. public event DelinkObjectHandler OnDelinkObject;
  163. public event CreateObjectInventoryHandler OnCreateObjectInventory;
  164. public event CopyObjectInventoryHandler OnCopyObjectInventory;
  165. public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv;
  166. public event DoDropInObjectInv OnDropInObjectInv;
  167. public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
  168. public event TransferObjectInventoryHandler OnTransferObjectInventory;
  169. public event CreateUserInventoryHandler OnCreateUserInventory;
  170. public event EditUserInventoryHandler OnEditUserInventory;
  171. public event CopyUserInventoryHandler OnCopyUserInventory;
  172. public event DeleteUserInventoryHandler OnDeleteUserInventory;
  173. public event TransferUserInventoryHandler OnTransferUserInventory;
  174. public event TeleportHandler OnTeleport;
  175. public event ControlPrimMediaHandler OnControlPrimMedia;
  176. public event InteractWithPrimMediaHandler OnInteractWithPrimMedia;
  177. #endregion
  178. #region Object Permission Checks
  179. public uint GenerateClientFlags( SceneObjectPart part, ScenePresence sp)
  180. {
  181. // libomv will moan about PrimFlags.ObjectYouOfficer being
  182. // obsolete...
  183. #pragma warning disable 0612
  184. const PrimFlags DEFAULT_FLAGS =
  185. PrimFlags.ObjectModify |
  186. PrimFlags.ObjectCopy |
  187. PrimFlags.ObjectMove |
  188. PrimFlags.ObjectTransfer |
  189. PrimFlags.ObjectYouOwner |
  190. PrimFlags.ObjectAnyOwner |
  191. PrimFlags.ObjectOwnerModify;
  192. #pragma warning restore 0612
  193. if (part == null)
  194. return 0;
  195. uint perms = part.GetEffectiveObjectFlags() | (uint)DEFAULT_FLAGS;
  196. GenerateClientFlagsHandler handlerGenerateClientFlags = OnGenerateClientFlags;
  197. if (handlerGenerateClientFlags != null)
  198. {
  199. Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
  200. foreach (GenerateClientFlagsHandler check in list)
  201. {
  202. perms &= check(part, sp, perms);
  203. }
  204. }
  205. return perms;
  206. }
  207. public void SetBypassPermissions(bool value)
  208. {
  209. SetBypassPermissionsHandler handler = OnSetBypassPermissions;
  210. if (handler != null)
  211. handler(value);
  212. }
  213. public bool BypassPermissions()
  214. {
  215. BypassPermissionsHandler handler = OnBypassPermissions;
  216. if (handler != null)
  217. {
  218. Delegate[] list = handler.GetInvocationList();
  219. foreach (BypassPermissionsHandler h in list)
  220. {
  221. if (h() == false)
  222. return false;
  223. }
  224. }
  225. return true;
  226. }
  227. public bool PropagatePermissions()
  228. {
  229. PropagatePermissionsHandler handler = OnPropagatePermissions;
  230. if (handler != null)
  231. {
  232. Delegate[] list = handler.GetInvocationList();
  233. foreach (PropagatePermissionsHandler h in list)
  234. {
  235. if (h() == false)
  236. return false;
  237. }
  238. }
  239. return true;
  240. }
  241. #region REZ OBJECT
  242. public bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition)
  243. {
  244. RezObjectHandler handler = OnRezObject;
  245. if (handler != null)
  246. {
  247. Delegate[] list = handler.GetInvocationList();
  248. foreach (RezObjectHandler h in list)
  249. {
  250. if (h(objectCount, owner,objectPosition) == false)
  251. return false;
  252. }
  253. }
  254. return true;
  255. }
  256. #endregion
  257. #region DELETE OBJECT
  258. public bool CanDeleteObject(UUID objectID, UUID deleter)
  259. {
  260. bool result = true;
  261. DeleteObjectHandlerByIDs handler = OnDeleteObjectByIDs;
  262. if (handler != null)
  263. {
  264. Delegate[] list = handler.GetInvocationList();
  265. foreach (DeleteObjectHandlerByIDs h in list)
  266. {
  267. if (h(objectID, deleter) == false)
  268. {
  269. result = false;
  270. break;
  271. }
  272. }
  273. }
  274. return result;
  275. }
  276. public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client)
  277. {
  278. DeleteObjectHandler handler = OnDeleteObject;
  279. if (handler != null)
  280. {
  281. if(sog == null || client == null || client.SceneAgent == null)
  282. return false;
  283. ScenePresence sp = client.SceneAgent as ScenePresence;
  284. Delegate[] list = handler.GetInvocationList();
  285. foreach (DeleteObjectHandler h in list)
  286. {
  287. if (h(sog, sp) == false)
  288. return false;
  289. }
  290. }
  291. return true;
  292. }
  293. public bool CanTransferObject(UUID objectID, UUID recipient)
  294. {
  295. TransferObjectHandler handler = OnTransferObject;
  296. if (handler != null)
  297. {
  298. Delegate[] list = handler.GetInvocationList();
  299. foreach (TransferObjectHandler h in list)
  300. {
  301. if (h(objectID, recipient) == false)
  302. return false;
  303. }
  304. }
  305. return true;
  306. }
  307. #endregion
  308. #region TAKE OBJECT
  309. public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
  310. {
  311. TakeObjectHandler handler = OnTakeObject;
  312. if (handler != null)
  313. {
  314. if(sog == null || sp == null)
  315. return false;
  316. Delegate[] list = handler.GetInvocationList();
  317. foreach (TakeObjectHandler h in list)
  318. {
  319. if (h(sog, sp) == false)
  320. return false;
  321. }
  322. }
  323. // m_log.DebugFormat(
  324. // "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}",
  325. // objectID, AvatarTakingUUID, result);
  326. return true;
  327. }
  328. #endregion
  329. #region SELL GROUP OBJECT
  330. public bool CanSellGroupObject(UUID userID, UUID groupID)
  331. {
  332. SellGroupObjectHandler handler = OnSellGroupObject;
  333. if (handler != null)
  334. {
  335. Delegate[] list = handler.GetInvocationList();
  336. foreach (SellGroupObjectHandler h in list)
  337. {
  338. if (h(userID, groupID) == false)
  339. return false;
  340. }
  341. }
  342. //m_log.DebugFormat(
  343. // "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}",
  344. // userID, groupID, result);
  345. return true;
  346. }
  347. #endregion
  348. #region SELL OBJECT
  349. public bool CanSellObject(IClientAPI client, SceneObjectGroup sog, byte saleType)
  350. {
  351. SellObjectHandler handler = OnSellObject;
  352. if (handler != null)
  353. {
  354. if(sog == null || client == null || client.SceneAgent == null)
  355. return false;
  356. ScenePresence sp = client.SceneAgent as ScenePresence;
  357. Delegate[] list = handler.GetInvocationList();
  358. foreach (SellObjectHandler h in list)
  359. {
  360. if (h(sog, sp, saleType) == false)
  361. return false;
  362. }
  363. }
  364. return true;
  365. }
  366. public bool CanSellObject(UUID userID, SceneObjectGroup sog, byte saleType)
  367. {
  368. SellObjectHandlerByUserID handler = OnSellObjectByUserID;
  369. if (handler != null)
  370. {
  371. if(sog == null)
  372. return false;
  373. Delegate[] list = handler.GetInvocationList();
  374. foreach (SellObjectHandlerByUserID h in list)
  375. {
  376. if (h(sog, userID, saleType) == false)
  377. return false;
  378. }
  379. }
  380. return true;
  381. }
  382. #endregion
  383. #region TAKE COPY OBJECT
  384. public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
  385. {
  386. TakeCopyObjectHandler handler = OnTakeCopyObject;
  387. if (handler != null)
  388. {
  389. if(sog == null || sp == null)
  390. return false;
  391. Delegate[] list = handler.GetInvocationList();
  392. foreach (TakeCopyObjectHandler h in list)
  393. {
  394. if (h(sog, sp) == false)
  395. return false;
  396. }
  397. }
  398. // m_log.DebugFormat(
  399. // "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}",
  400. // objectID, userID, result);
  401. return true;
  402. }
  403. #endregion
  404. #region DUPLICATE OBJECT
  405. public bool CanDuplicateObject(SceneObjectGroup sog, UUID agentID)
  406. {
  407. DuplicateObjectHandler handler = OnDuplicateObject;
  408. if (handler != null)
  409. {
  410. if(sog == null || sog.IsDeleted)
  411. return false;
  412. ScenePresence sp = m_scene.GetScenePresence(agentID);
  413. if(sp == null || sp.IsDeleted)
  414. return false;
  415. Delegate[] list = handler.GetInvocationList();
  416. foreach (DuplicateObjectHandler h in list)
  417. {
  418. if (h(sog, sp) == false)
  419. return false;
  420. }
  421. }
  422. return true;
  423. }
  424. #endregion
  425. #region persence EDIT or MOVE OBJECT
  426. private const uint CANSELECTMASK = (uint)(
  427. PrimFlags.ObjectMove |
  428. PrimFlags.ObjectModify |
  429. PrimFlags.ObjectOwnerModify
  430. );
  431. public bool CanChangeSelectedState(SceneObjectPart part, ScenePresence sp)
  432. {
  433. uint perms = GenerateClientFlags(part, sp);
  434. return (perms & CANSELECTMASK) != 0;
  435. }
  436. #endregion
  437. #region EDIT OBJECT
  438. public bool CanEditObject(UUID objectID, UUID editorID)
  439. {
  440. EditObjectByIDsHandler handler = OnEditObjectByIDs;
  441. if (handler != null)
  442. {
  443. Delegate[] list = handler.GetInvocationList();
  444. foreach (EditObjectByIDsHandler h in list)
  445. {
  446. if (h(objectID, editorID) == false)
  447. return false;
  448. }
  449. }
  450. return true;
  451. }
  452. public bool CanEditObject(SceneObjectGroup sog, IClientAPI client)
  453. {
  454. EditObjectHandler handler = OnEditObject;
  455. if (handler != null)
  456. {
  457. if(sog == null || client == null || client.SceneAgent == null)
  458. return false;
  459. ScenePresence sp = client.SceneAgent as ScenePresence;
  460. Delegate[] list = handler.GetInvocationList();
  461. foreach (EditObjectHandler h in list)
  462. {
  463. if (h(sog, sp) == false)
  464. return false;
  465. }
  466. }
  467. return true;
  468. }
  469. public bool CanEditObjectPermissions(SceneObjectGroup sog, UUID editorID)
  470. {
  471. EditObjectPermsHandler handler = OnEditObjectPerms;
  472. if (handler != null)
  473. {
  474. if(sog == null)
  475. return false;
  476. Delegate[] list = handler.GetInvocationList();
  477. foreach (EditObjectPermsHandler h in list)
  478. {
  479. if (h(sog, editorID) == false)
  480. return false;
  481. }
  482. }
  483. return true;
  484. }
  485. public bool CanEditObjectInventory(UUID objectID, UUID editorID)
  486. {
  487. EditObjectInventoryHandler handler = OnEditObjectInventory;
  488. if (handler != null)
  489. {
  490. Delegate[] list = handler.GetInvocationList();
  491. foreach (EditObjectInventoryHandler h in list)
  492. {
  493. if (h(objectID, editorID) == false)
  494. return false;
  495. }
  496. }
  497. return true;
  498. }
  499. #endregion
  500. #region MOVE OBJECT
  501. public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
  502. {
  503. MoveObjectHandler handler = OnMoveObject;
  504. if (handler != null)
  505. {
  506. if(sog == null || client == null || client.SceneAgent == null)
  507. return false;
  508. ScenePresence sp = client.SceneAgent as ScenePresence;
  509. Delegate[] list = handler.GetInvocationList();
  510. foreach (MoveObjectHandler h in list)
  511. {
  512. if (h(sog, sp) == false)
  513. return false;
  514. }
  515. }
  516. return true;
  517. }
  518. #endregion
  519. #region OBJECT ENTRY
  520. public bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
  521. {
  522. ObjectEntryHandler handler = OnObjectEntry;
  523. if (handler != null)
  524. {
  525. Delegate[] list = handler.GetInvocationList();
  526. foreach (ObjectEntryHandler h in list)
  527. {
  528. if (h(sog, enteringRegion, newPoint) == false)
  529. return false;
  530. }
  531. }
  532. return true;
  533. }
  534. public bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject land)
  535. {
  536. ObjectEnterWithScriptsHandler handler = OnObjectEnterWithScripts;
  537. if (handler != null)
  538. {
  539. Delegate[] list = handler.GetInvocationList();
  540. foreach (ObjectEnterWithScriptsHandler h in list)
  541. {
  542. if (h(sog, land) == false)
  543. return false;
  544. }
  545. }
  546. return true;
  547. }
  548. #endregion
  549. #region RETURN OBJECT
  550. public bool CanReturnObjects(ILandObject land, IClientAPI client, List<SceneObjectGroup> objects)
  551. {
  552. ReturnObjectsHandler handler = OnReturnObjects;
  553. if (handler != null)
  554. {
  555. if(objects == null)
  556. return false;
  557. ScenePresence sp = null;
  558. if(client != null && client.SceneAgent != null)
  559. sp = client.SceneAgent as ScenePresence;
  560. Delegate[] list = handler.GetInvocationList();
  561. foreach (ReturnObjectsHandler h in list)
  562. {
  563. if (h(land, sp, objects) == false)
  564. return false;
  565. }
  566. }
  567. // m_log.DebugFormat(
  568. // "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}",
  569. // user, objects.Count, land.LandData.Name, result);
  570. return true;
  571. }
  572. #endregion
  573. #region INSTANT MESSAGE
  574. public bool CanInstantMessage(UUID user, UUID target)
  575. {
  576. InstantMessageHandler handler = OnInstantMessage;
  577. if (handler != null)
  578. {
  579. Delegate[] list = handler.GetInvocationList();
  580. foreach (InstantMessageHandler h in list)
  581. {
  582. if (h(user, target) == false)
  583. return false;
  584. }
  585. }
  586. return true;
  587. }
  588. #endregion
  589. #region INVENTORY TRANSFER
  590. public bool CanInventoryTransfer(UUID user, UUID target)
  591. {
  592. InventoryTransferHandler handler = OnInventoryTransfer;
  593. if (handler != null)
  594. {
  595. Delegate[] list = handler.GetInvocationList();
  596. foreach (InventoryTransferHandler h in list)
  597. {
  598. if (h(user, target) == false)
  599. return false;
  600. }
  601. }
  602. return true;
  603. }
  604. #endregion
  605. #region VIEW SCRIPT
  606. public bool CanViewScript(UUID script, UUID objectID, UUID user)
  607. {
  608. ViewScriptHandler handler = OnViewScript;
  609. if (handler != null)
  610. {
  611. Delegate[] list = handler.GetInvocationList();
  612. foreach (ViewScriptHandler h in list)
  613. {
  614. if (h(script, objectID, user) == false)
  615. return false;
  616. }
  617. }
  618. return true;
  619. }
  620. public bool CanViewNotecard(UUID script, UUID objectID, UUID user)
  621. {
  622. ViewNotecardHandler handler = OnViewNotecard;
  623. if (handler != null)
  624. {
  625. Delegate[] list = handler.GetInvocationList();
  626. foreach (ViewNotecardHandler h in list)
  627. {
  628. if (h(script, objectID, user) == false)
  629. return false;
  630. }
  631. }
  632. return true;
  633. }
  634. #endregion
  635. #region EDIT SCRIPT
  636. public bool CanEditScript(UUID script, UUID objectID, UUID user)
  637. {
  638. EditScriptHandler handler = OnEditScript;
  639. if (handler != null)
  640. {
  641. Delegate[] list = handler.GetInvocationList();
  642. foreach (EditScriptHandler h in list)
  643. {
  644. if (h(script, objectID, user) == false)
  645. return false;
  646. }
  647. }
  648. return true;
  649. }
  650. public bool CanEditNotecard(UUID script, UUID objectID, UUID user)
  651. {
  652. EditNotecardHandler handler = OnEditNotecard;
  653. if (handler != null)
  654. {
  655. Delegate[] list = handler.GetInvocationList();
  656. foreach (EditNotecardHandler h in list)
  657. {
  658. if (h(script, objectID, user) == false)
  659. return false;
  660. }
  661. }
  662. return true;
  663. }
  664. #endregion
  665. #region RUN SCRIPT (When Script Placed in Object)
  666. public bool CanRunScript(UUID script, UUID objectID, UUID user)
  667. {
  668. RunScriptHandlerByIDs handler = OnRunScriptByIDs;
  669. if (handler != null)
  670. {
  671. Delegate[] list = handler.GetInvocationList();
  672. foreach (RunScriptHandlerByIDs h in list)
  673. {
  674. if (h(script, objectID, user) == false)
  675. return false;
  676. }
  677. }
  678. return true;
  679. }
  680. public bool CanRunScript(TaskInventoryItem item, SceneObjectPart part)
  681. {
  682. RunScriptHandler handler = OnRunScript;
  683. if (handler != null)
  684. {
  685. if(item == null || part == null)
  686. return false;
  687. Delegate[] list = handler.GetInvocationList();
  688. foreach (RunScriptHandler h in list)
  689. {
  690. if (h(item, part) == false)
  691. return false;
  692. }
  693. }
  694. return true;
  695. }
  696. #endregion
  697. #region COMPILE SCRIPT (When Script needs to get (re)compiled)
  698. public bool CanCompileScript(UUID ownerUUID, int scriptType)
  699. {
  700. CompileScriptHandler handler = OnCompileScript;
  701. if (handler != null)
  702. {
  703. Delegate[] list = handler.GetInvocationList();
  704. foreach (CompileScriptHandler h in list)
  705. {
  706. if (h(ownerUUID, scriptType) == false)
  707. return false;
  708. }
  709. }
  710. return true;
  711. }
  712. #endregion
  713. #region START SCRIPT (When Script run box is Checked after placed in object)
  714. public bool CanStartScript(UUID script, UUID user)
  715. {
  716. StartScriptHandler handler = OnStartScript;
  717. if (handler != null)
  718. {
  719. Delegate[] list = handler.GetInvocationList();
  720. foreach (StartScriptHandler h in list)
  721. {
  722. if (h(script, user) == false)
  723. return false;
  724. }
  725. }
  726. return true;
  727. }
  728. #endregion
  729. #region STOP SCRIPT (When Script run box is unchecked after placed in object)
  730. public bool CanStopScript(UUID script, UUID user)
  731. {
  732. StopScriptHandler handler = OnStopScript;
  733. if (handler != null)
  734. {
  735. Delegate[] list = handler.GetInvocationList();
  736. foreach (StopScriptHandler h in list)
  737. {
  738. if (h(script, user) == false)
  739. return false;
  740. }
  741. }
  742. return true;
  743. }
  744. #endregion
  745. #region RESET SCRIPT
  746. public bool CanResetScript(UUID prim, UUID script, UUID user)
  747. {
  748. ResetScriptHandler handler = OnResetScript;
  749. if (handler != null)
  750. {
  751. Delegate[] list = handler.GetInvocationList();
  752. foreach (ResetScriptHandler h in list)
  753. {
  754. if (h(prim, script, user) == false)
  755. return false;
  756. }
  757. }
  758. return true;
  759. }
  760. #endregion
  761. #region TERRAFORM LAND
  762. public bool CanTerraformLand(UUID user, Vector3 pos)
  763. {
  764. TerraformLandHandler handler = OnTerraformLand;
  765. if (handler != null)
  766. {
  767. Delegate[] list = handler.GetInvocationList();
  768. foreach (TerraformLandHandler h in list)
  769. {
  770. if (h(user, pos) == false)
  771. return false;
  772. }
  773. }
  774. return true;
  775. }
  776. #endregion
  777. #region RUN CONSOLE COMMAND
  778. public bool CanRunConsoleCommand(UUID user)
  779. {
  780. RunConsoleCommandHandler handler = OnRunConsoleCommand;
  781. if (handler != null)
  782. {
  783. Delegate[] list = handler.GetInvocationList();
  784. foreach (RunConsoleCommandHandler h in list)
  785. {
  786. if (h(user) == false)
  787. return false;
  788. }
  789. }
  790. return true;
  791. }
  792. #endregion
  793. #region CAN ISSUE ESTATE COMMAND
  794. public bool CanIssueEstateCommand(UUID user, bool ownerCommand)
  795. {
  796. IssueEstateCommandHandler handler = OnIssueEstateCommand;
  797. if (handler != null)
  798. {
  799. Delegate[] list = handler.GetInvocationList();
  800. foreach (IssueEstateCommandHandler h in list)
  801. {
  802. if (h(user, ownerCommand) == false)
  803. return false;
  804. }
  805. }
  806. return true;
  807. }
  808. #endregion
  809. #region CAN BE GODLIKE
  810. public bool IsGod(UUID user)
  811. {
  812. IsAdministratorHandler handler = OnIsAdministrator;
  813. if (handler != null)
  814. {
  815. Delegate[] list = handler.GetInvocationList();
  816. foreach (IsAdministratorHandler h in list)
  817. {
  818. if (h(user) == false)
  819. return false;
  820. }
  821. }
  822. return true;
  823. }
  824. public bool IsGridGod(UUID user)
  825. {
  826. IsGridGodHandler handler = OnIsGridGod;
  827. if (handler != null)
  828. {
  829. Delegate[] list = handler.GetInvocationList();
  830. foreach (IsGridGodHandler h in list)
  831. {
  832. if (h(user) == false)
  833. return false;
  834. }
  835. }
  836. return true;
  837. }
  838. public bool IsAdministrator(UUID user)
  839. {
  840. IsAdministratorHandler handler = OnIsAdministrator;
  841. if (handler != null)
  842. {
  843. Delegate[] list = handler.GetInvocationList();
  844. foreach (IsAdministratorHandler h in list)
  845. {
  846. if (h(user) == false)
  847. return false;
  848. }
  849. }
  850. return true;
  851. }
  852. #endregion
  853. public bool IsEstateManager(UUID user)
  854. {
  855. IsEstateManagerHandler handler = OnIsEstateManager;
  856. if (handler != null)
  857. {
  858. Delegate[] list = handler.GetInvocationList();
  859. foreach (IsEstateManagerHandler h in list)
  860. {
  861. if (h(user) == false)
  862. return false;
  863. }
  864. }
  865. return true;
  866. }
  867. #region EDIT PARCEL
  868. public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, bool allowManager)
  869. {
  870. EditParcelPropertiesHandler handler = OnEditParcelProperties;
  871. if (handler != null)
  872. {
  873. Delegate[] list = handler.GetInvocationList();
  874. foreach (EditParcelPropertiesHandler h in list)
  875. {
  876. if (h(user, parcel, p, allowManager) == false)
  877. return false;
  878. }
  879. }
  880. return true;
  881. }
  882. #endregion
  883. #region SELL PARCEL
  884. public bool CanSellParcel(UUID user, ILandObject parcel)
  885. {
  886. SellParcelHandler handler = OnSellParcel;
  887. if (handler != null)
  888. {
  889. Delegate[] list = handler.GetInvocationList();
  890. foreach (SellParcelHandler h in list)
  891. {
  892. if (h(user, parcel) == false)
  893. return false;
  894. }
  895. }
  896. return true;
  897. }
  898. #endregion
  899. #region ABANDON PARCEL
  900. public bool CanAbandonParcel(UUID user, ILandObject parcel)
  901. {
  902. AbandonParcelHandler handler = OnAbandonParcel;
  903. if (handler != null)
  904. {
  905. Delegate[] list = handler.GetInvocationList();
  906. foreach (AbandonParcelHandler h in list)
  907. {
  908. if (h(user, parcel) == false)
  909. return false;
  910. }
  911. }
  912. return true;
  913. }
  914. #endregion
  915. public bool CanReclaimParcel(UUID user, ILandObject parcel)
  916. {
  917. ReclaimParcelHandler handler = OnReclaimParcel;
  918. if (handler != null)
  919. {
  920. Delegate[] list = handler.GetInvocationList();
  921. foreach (ReclaimParcelHandler h in list)
  922. {
  923. if (h(user, parcel) == false)
  924. return false;
  925. }
  926. }
  927. return true;
  928. }
  929. public bool CanDeedParcel(UUID user, ILandObject parcel)
  930. {
  931. DeedParcelHandler handler = OnDeedParcel;
  932. if (handler != null)
  933. {
  934. Delegate[] list = handler.GetInvocationList();
  935. foreach (DeedParcelHandler h in list)
  936. {
  937. if (h(user, parcel) == false)
  938. return false;
  939. }
  940. }
  941. return true;
  942. }
  943. public bool CanDeedObject(IClientAPI client, SceneObjectGroup sog, UUID targetGroupID)
  944. {
  945. DeedObjectHandler handler = OnDeedObject;
  946. if (handler != null)
  947. {
  948. if(sog == null || client == null || client.SceneAgent == null || targetGroupID == UUID.Zero)
  949. return false;
  950. ScenePresence sp = client.SceneAgent as ScenePresence;
  951. Delegate[] list = handler.GetInvocationList();
  952. foreach (DeedObjectHandler h in list)
  953. {
  954. if (h(sp, sog, targetGroupID) == false)
  955. return false;
  956. }
  957. }
  958. return true;
  959. }
  960. public bool CanBuyLand(UUID user, ILandObject parcel)
  961. {
  962. BuyLandHandler handler = OnBuyLand;
  963. if (handler != null)
  964. {
  965. Delegate[] list = handler.GetInvocationList();
  966. foreach (BuyLandHandler h in list)
  967. {
  968. if (h(user, parcel) == false)
  969. return false;
  970. }
  971. }
  972. return true;
  973. }
  974. public bool CanLinkObject(UUID user, UUID objectID)
  975. {
  976. LinkObjectHandler handler = OnLinkObject;
  977. if (handler != null)
  978. {
  979. Delegate[] list = handler.GetInvocationList();
  980. foreach (LinkObjectHandler h in list)
  981. {
  982. if (h(user, objectID) == false)
  983. return false;
  984. }
  985. }
  986. return true;
  987. }
  988. public bool CanDelinkObject(UUID user, UUID objectID)
  989. {
  990. DelinkObjectHandler handler = OnDelinkObject;
  991. if (handler != null)
  992. {
  993. Delegate[] list = handler.GetInvocationList();
  994. foreach (DelinkObjectHandler h in list)
  995. {
  996. if (h(user, objectID) == false)
  997. return false;
  998. }
  999. }
  1000. return true;
  1001. }
  1002. #endregion
  1003. /// Check whether the specified user is allowed to directly create the given inventory type in a prim's
  1004. /// inventory (e.g. the New Script button in the 1.21 Linden Lab client).
  1005. /// </summary>
  1006. /// <param name="invType"></param>
  1007. /// <param name="objectID"></param>
  1008. /// <param name="userID"></param>
  1009. /// <returns></returns>
  1010. public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
  1011. {
  1012. CreateObjectInventoryHandler handler = OnCreateObjectInventory;
  1013. if (handler != null)
  1014. {
  1015. Delegate[] list = handler.GetInvocationList();
  1016. foreach (CreateObjectInventoryHandler h in list)
  1017. {
  1018. if (h(invType, objectID, userID) == false)
  1019. return false;
  1020. }
  1021. }
  1022. return true;
  1023. }
  1024. public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
  1025. {
  1026. CopyObjectInventoryHandler handler = OnCopyObjectInventory;
  1027. if (handler != null)
  1028. {
  1029. Delegate[] list = handler.GetInvocationList();
  1030. foreach (CopyObjectInventoryHandler h in list)
  1031. {
  1032. if (h(itemID, objectID, userID) == false)
  1033. return false;
  1034. }
  1035. }
  1036. return true;
  1037. }
  1038. public bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
  1039. {
  1040. DoObjectInvToObjectInv handler = OnDoObjectInvToObjectInv;
  1041. if (handler != null)
  1042. {
  1043. if (sourcePart == null || destPart == null || item == null)
  1044. return false;
  1045. Delegate[] list = handler.GetInvocationList();
  1046. foreach (DoObjectInvToObjectInv h in list)
  1047. {
  1048. if (h(item, sourcePart, destPart) == false)
  1049. return false;
  1050. }
  1051. }
  1052. return true;
  1053. }
  1054. public bool CanDropInObjectInv(InventoryItemBase item, IClientAPI client, SceneObjectPart destPart)
  1055. {
  1056. DoDropInObjectInv handler = OnDropInObjectInv;
  1057. if (handler != null)
  1058. {
  1059. if (client == null || client.SceneAgent == null|| destPart == null || item == null)
  1060. return false;
  1061. ScenePresence sp = client.SceneAgent as ScenePresence;
  1062. if(sp == null || sp.IsDeleted)
  1063. return false;
  1064. Delegate[] list = handler.GetInvocationList();
  1065. foreach (DoDropInObjectInv h in list)
  1066. {
  1067. if (h(item, sp, destPart) == false)
  1068. return false;
  1069. }
  1070. }
  1071. return true;
  1072. }
  1073. public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
  1074. {
  1075. DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
  1076. if (handler != null)
  1077. {
  1078. Delegate[] list = handler.GetInvocationList();
  1079. foreach (DeleteObjectInventoryHandler h in list)
  1080. {
  1081. if (h(itemID, objectID, userID) == false)
  1082. return false;
  1083. }
  1084. }
  1085. return true;
  1086. }
  1087. public bool CanTransferObjectInventory(UUID itemID, UUID objectID, UUID userID)
  1088. {
  1089. TransferObjectInventoryHandler handler = OnTransferObjectInventory;
  1090. if (handler != null)
  1091. {
  1092. Delegate[] list = handler.GetInvocationList();
  1093. foreach (TransferObjectInventoryHandler h in list)
  1094. {
  1095. if (h(itemID, objectID, userID) == false)
  1096. return false;
  1097. }
  1098. }
  1099. return true;
  1100. }
  1101. /// <summary>
  1102. /// Check whether the specified user is allowed to create the given inventory type in their inventory.
  1103. /// </summary>
  1104. /// <param name="invType"></param>
  1105. /// <param name="userID"></param>
  1106. /// <returns></returns>
  1107. public bool CanCreateUserInventory(int invType, UUID userID)
  1108. {
  1109. CreateUserInventoryHandler handler = OnCreateUserInventory;
  1110. if (handler != null)
  1111. {
  1112. Delegate[] list = handler.GetInvocationList();
  1113. foreach (CreateUserInventoryHandler h in list)
  1114. {
  1115. if (h(invType, userID) == false)
  1116. return false;
  1117. }
  1118. }
  1119. return true;
  1120. }
  1121. /// <summary>
  1122. /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
  1123. /// </summary>
  1124. /// <param name="itemID"></param>
  1125. /// <param name="userID"></param>
  1126. /// <returns></returns>
  1127. public bool CanEditUserInventory(UUID itemID, UUID userID)
  1128. {
  1129. EditUserInventoryHandler handler = OnEditUserInventory;
  1130. if (handler != null)
  1131. {
  1132. Delegate[] list = handler.GetInvocationList();
  1133. foreach (EditUserInventoryHandler h in list)
  1134. {
  1135. if (h(itemID, userID) == false)
  1136. return false;
  1137. }
  1138. }
  1139. return true;
  1140. }
  1141. /// <summary>
  1142. /// Check whether the specified user is allowed to copy the given inventory item from their own inventory.
  1143. /// </summary>
  1144. /// <param name="itemID"></param>
  1145. /// <param name="userID"></param>
  1146. /// <returns></returns>
  1147. public bool CanCopyUserInventory(UUID itemID, UUID userID)
  1148. {
  1149. CopyUserInventoryHandler handler = OnCopyUserInventory;
  1150. if (handler != null)
  1151. {
  1152. Delegate[] list = handler.GetInvocationList();
  1153. foreach (CopyUserInventoryHandler h in list)
  1154. {
  1155. if (h(itemID, userID) == false)
  1156. return false;
  1157. }
  1158. }
  1159. return true;
  1160. }
  1161. /// <summary>
  1162. /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
  1163. /// </summary>
  1164. /// <param name="itemID"></param>
  1165. /// <param name="userID"></param>
  1166. /// <returns></returns>
  1167. public bool CanDeleteUserInventory(UUID itemID, UUID userID)
  1168. {
  1169. DeleteUserInventoryHandler handler = OnDeleteUserInventory;
  1170. if (handler != null)
  1171. {
  1172. Delegate[] list = handler.GetInvocationList();
  1173. foreach (DeleteUserInventoryHandler h in list)
  1174. {
  1175. if (h(itemID, userID) == false)
  1176. return false;
  1177. }
  1178. }
  1179. return true;
  1180. }
  1181. public bool CanTransferUserInventory(UUID itemID, UUID userID, UUID recipientID)
  1182. {
  1183. TransferUserInventoryHandler handler = OnTransferUserInventory;
  1184. if (handler != null)
  1185. {
  1186. Delegate[] list = handler.GetInvocationList();
  1187. foreach (TransferUserInventoryHandler h in list)
  1188. {
  1189. if (h(itemID, userID, recipientID) == false)
  1190. return false;
  1191. }
  1192. }
  1193. return true;
  1194. }
  1195. public bool CanTeleport(UUID userID)
  1196. {
  1197. TeleportHandler handler = OnTeleport;
  1198. if (handler != null)
  1199. {
  1200. Delegate[] list = handler.GetInvocationList();
  1201. foreach (TeleportHandler h in list)
  1202. {
  1203. if (h(userID, m_scene) == false)
  1204. return false;
  1205. }
  1206. }
  1207. return true;
  1208. }
  1209. public bool CanControlPrimMedia(UUID userID, UUID primID, int face)
  1210. {
  1211. ControlPrimMediaHandler handler = OnControlPrimMedia;
  1212. if (handler != null)
  1213. {
  1214. Delegate[] list = handler.GetInvocationList();
  1215. foreach (ControlPrimMediaHandler h in list)
  1216. {
  1217. if (h(userID, primID, face) == false)
  1218. return false;
  1219. }
  1220. }
  1221. return true;
  1222. }
  1223. public bool CanInteractWithPrimMedia(UUID userID, UUID primID, int face)
  1224. {
  1225. InteractWithPrimMediaHandler handler = OnInteractWithPrimMedia;
  1226. if (handler != null)
  1227. {
  1228. Delegate[] list = handler.GetInvocationList();
  1229. foreach (InteractWithPrimMediaHandler h in list)
  1230. {
  1231. if (h(userID, primID, face) == false)
  1232. return false;
  1233. }
  1234. }
  1235. return true;
  1236. }
  1237. }
  1238. }