Scene.Permissions.cs 49 KB

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