123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968 |
- /*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- using System;
- using System.Collections.Generic;
- using System.Text;
- using OpenMetaverse;
- using OpenSim.Framework;
- using OpenSim.Region.Framework.Interfaces;
- namespace OpenSim.Region.Framework.Scenes
- {
- #region Delegates
- public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID);
- public delegate void SetBypassPermissionsHandler(bool value);
- public delegate bool BypassPermissionsHandler();
- public delegate bool PropagatePermissionsHandler();
- public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
- public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
- public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
- public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
- public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
- public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
- public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
- public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
- public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
- public delegate bool ReturnObjectHandler(UUID objectID, UUID returnerID, Scene scene);
- public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
- public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene);
- public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
- public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
- public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
- public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
- public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
- public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene);
- public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene);
- public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene);
- public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
- public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
- public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene);
- public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
- public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
- public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene);
- public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool LinkObjectHandler(UUID user, UUID objectID);
- public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
- public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
- public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
- public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
- public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
- public delegate bool EditUserInventoryHandler(UUID itemID, UUID userID);
- public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID);
- public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
- public delegate bool TeleportHandler(UUID userID, Scene scene);
- public delegate bool UseObjectReturnHandler(ILandObject landData, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene);
- #endregion
- public class ScenePermissions
- {
- private Scene m_scene;
- public ScenePermissions(Scene scene)
- {
- m_scene = scene;
- }
- #region Events
- public event GenerateClientFlagsHandler OnGenerateClientFlags;
- public event SetBypassPermissionsHandler OnSetBypassPermissions;
- public event BypassPermissionsHandler OnBypassPermissions;
- public event PropagatePermissionsHandler OnPropagatePermissions;
- public event RezObjectHandler OnRezObject;
- public event DeleteObjectHandler OnDeleteObject;
- public event TakeObjectHandler OnTakeObject;
- public event TakeCopyObjectHandler OnTakeCopyObject;
- public event DuplicateObjectHandler OnDuplicateObject;
- public event EditObjectHandler OnEditObject;
- public event EditObjectInventoryHandler OnEditObjectInventory;
- public event MoveObjectHandler OnMoveObject;
- public event ObjectEntryHandler OnObjectEntry;
- public event ReturnObjectHandler OnReturnObject;
- public event InstantMessageHandler OnInstantMessage;
- public event InventoryTransferHandler OnInventoryTransfer;
- public event ViewScriptHandler OnViewScript;
- public event ViewNotecardHandler OnViewNotecard;
- public event EditScriptHandler OnEditScript;
- public event EditNotecardHandler OnEditNotecard;
- public event RunScriptHandler OnRunScript;
- public event CompileScriptHandler OnCompileScript;
- public event StartScriptHandler OnStartScript;
- public event StopScriptHandler OnStopScript;
- public event ResetScriptHandler OnResetScript;
- public event TerraformLandHandler OnTerraformLand;
- public event RunConsoleCommandHandler OnRunConsoleCommand;
- public event IssueEstateCommandHandler OnIssueEstateCommand;
- public event IsGodHandler OnIsGod;
- public event EditParcelHandler OnEditParcel;
- public event SellParcelHandler OnSellParcel;
- public event AbandonParcelHandler OnAbandonParcel;
- public event ReclaimParcelHandler OnReclaimParcel;
- public event DeedParcelHandler OnDeedParcel;
- public event DeedObjectHandler OnDeedObject;
- public event BuyLandHandler OnBuyLand;
- public event LinkObjectHandler OnLinkObject;
- public event DelinkObjectHandler OnDelinkObject;
- public event CreateObjectInventoryHandler OnCreateObjectInventory;
- public event CopyObjectInventoryHandler OnCopyObjectInventory;
- public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
- public event CreateUserInventoryHandler OnCreateUserInventory;
- public event EditUserInventoryHandler OnEditUserInventory;
- public event CopyUserInventoryHandler OnCopyUserInventory;
- public event DeleteUserInventoryHandler OnDeleteUserInventory;
- public event TeleportHandler OnTeleport;
- public event UseObjectReturnHandler OnUseObjectReturn;
- #endregion
- #region Object Permission Checks
- public uint GenerateClientFlags(UUID userID, UUID objectID)
- {
- // libomv will moan about PrimFlags.ObjectYouOfficer being
- // obsolete...
- #pragma warning disable 0612
- const PrimFlags DEFAULT_FLAGS =
- PrimFlags.ObjectModify |
- PrimFlags.ObjectCopy |
- PrimFlags.ObjectMove |
- PrimFlags.ObjectTransfer |
- PrimFlags.ObjectYouOwner |
- PrimFlags.ObjectAnyOwner |
- PrimFlags.ObjectOwnerModify |
- PrimFlags.ObjectYouOfficer;
- #pragma warning restore 0612
- SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
- if (part == null)
- return 0;
- uint perms = part.GetEffectiveObjectFlags() | (uint)DEFAULT_FLAGS;
- GenerateClientFlagsHandler handlerGenerateClientFlags = OnGenerateClientFlags;
- if (handlerGenerateClientFlags != null)
- {
- Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
- foreach (GenerateClientFlagsHandler check in list)
- {
- perms &= check(userID, objectID);
- }
- }
- return perms;
- }
- public void SetBypassPermissions(bool value)
- {
- SetBypassPermissionsHandler handler = OnSetBypassPermissions;
- if (handler != null)
- handler(value);
- }
- public bool BypassPermissions()
- {
- BypassPermissionsHandler handler = OnBypassPermissions;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (BypassPermissionsHandler h in list)
- {
- if (h() == false)
- return false;
- }
- }
- return true;
- }
- public bool PropagatePermissions()
- {
- PropagatePermissionsHandler handler = OnPropagatePermissions;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (PropagatePermissionsHandler h in list)
- {
- if (h() == false)
- return false;
- }
- }
- return true;
- }
- #region REZ OBJECT
- public bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition)
- {
- RezObjectHandler handler = OnRezObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (RezObjectHandler h in list)
- {
- if (h(objectCount, owner,objectPosition, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region DELETE OBJECT
- public bool CanDeleteObject(UUID objectID, UUID deleter)
- {
- DeleteObjectHandler handler = OnDeleteObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (DeleteObjectHandler h in list)
- {
- if (h(objectID, deleter, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region TAKE OBJECT
- public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID)
- {
- TakeObjectHandler handler = OnTakeObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (TakeObjectHandler h in list)
- {
- if (h(objectID, AvatarTakingUUID, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region TAKE COPY OBJECT
- public bool CanTakeCopyObject(UUID objectID, UUID userID)
- {
- TakeCopyObjectHandler handler = OnTakeCopyObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (TakeCopyObjectHandler h in list)
- {
- if (h(objectID, userID, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region DUPLICATE OBJECT
- public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition)
- {
- DuplicateObjectHandler handler = OnDuplicateObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (DuplicateObjectHandler h in list)
- {
- if (h(objectCount, objectID, owner, m_scene, objectPosition) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region EDIT OBJECT
- public bool CanEditObject(UUID objectID, UUID editorID)
- {
- EditObjectHandler handler = OnEditObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (EditObjectHandler h in list)
- {
- if (h(objectID, editorID, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanEditObjectInventory(UUID objectID, UUID editorID)
- {
- EditObjectInventoryHandler handler = OnEditObjectInventory;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (EditObjectInventoryHandler h in list)
- {
- if (h(objectID, editorID, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region MOVE OBJECT
- public bool CanMoveObject(UUID objectID, UUID moverID)
- {
- MoveObjectHandler handler = OnMoveObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (MoveObjectHandler h in list)
- {
- if (h(objectID, moverID, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region OBJECT ENTRY
- public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint)
- {
- ObjectEntryHandler handler = OnObjectEntry;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (ObjectEntryHandler h in list)
- {
- if (h(objectID, enteringRegion, newPoint, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region RETURN OBJECT
- public bool CanReturnObject(UUID objectID, UUID returnerID)
- {
- ReturnObjectHandler handler = OnReturnObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (ReturnObjectHandler h in list)
- {
- if (h(objectID, returnerID, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region INSTANT MESSAGE
- public bool CanInstantMessage(UUID user, UUID target)
- {
- InstantMessageHandler handler = OnInstantMessage;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (InstantMessageHandler h in list)
- {
- if (h(user, target, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region INVENTORY TRANSFER
- public bool CanInventoryTransfer(UUID user, UUID target)
- {
- InventoryTransferHandler handler = OnInventoryTransfer;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (InventoryTransferHandler h in list)
- {
- if (h(user, target, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region VIEW SCRIPT
- public bool CanViewScript(UUID script, UUID objectID, UUID user)
- {
- ViewScriptHandler handler = OnViewScript;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (ViewScriptHandler h in list)
- {
- if (h(script, objectID, user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanViewNotecard(UUID script, UUID objectID, UUID user)
- {
- ViewNotecardHandler handler = OnViewNotecard;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (ViewNotecardHandler h in list)
- {
- if (h(script, objectID, user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region EDIT SCRIPT
- public bool CanEditScript(UUID script, UUID objectID, UUID user)
- {
- EditScriptHandler handler = OnEditScript;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (EditScriptHandler h in list)
- {
- if (h(script, objectID, user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanEditNotecard(UUID script, UUID objectID, UUID user)
- {
- EditNotecardHandler handler = OnEditNotecard;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (EditNotecardHandler h in list)
- {
- if (h(script, objectID, user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region RUN SCRIPT (When Script Placed in Object)
- public bool CanRunScript(UUID script, UUID objectID, UUID user)
- {
- RunScriptHandler handler = OnRunScript;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (RunScriptHandler h in list)
- {
- if (h(script, objectID, user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region COMPILE SCRIPT (When Script needs to get (re)compiled)
- public bool CanCompileScript(UUID ownerUUID, int scriptType)
- {
- CompileScriptHandler handler = OnCompileScript;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (CompileScriptHandler h in list)
- {
- if (h(ownerUUID, scriptType, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region START SCRIPT (When Script run box is Checked after placed in object)
- public bool CanStartScript(UUID script, UUID user)
- {
- StartScriptHandler handler = OnStartScript;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (StartScriptHandler h in list)
- {
- if (h(script, user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region STOP SCRIPT (When Script run box is unchecked after placed in object)
- public bool CanStopScript(UUID script, UUID user)
- {
- StopScriptHandler handler = OnStopScript;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (StopScriptHandler h in list)
- {
- if (h(script, user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region RESET SCRIPT
- public bool CanResetScript(UUID prim, UUID script, UUID user)
- {
- ResetScriptHandler handler = OnResetScript;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (ResetScriptHandler h in list)
- {
- if (h(prim, script, user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region TERRAFORM LAND
- public bool CanTerraformLand(UUID user, Vector3 pos)
- {
- TerraformLandHandler handler = OnTerraformLand;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (TerraformLandHandler h in list)
- {
- if (h(user, pos, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region RUN CONSOLE COMMAND
- public bool CanRunConsoleCommand(UUID user)
- {
- RunConsoleCommandHandler handler = OnRunConsoleCommand;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (RunConsoleCommandHandler h in list)
- {
- if (h(user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region CAN ISSUE ESTATE COMMAND
- public bool CanIssueEstateCommand(UUID user, bool ownerCommand)
- {
- IssueEstateCommandHandler handler = OnIssueEstateCommand;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (IssueEstateCommandHandler h in list)
- {
- if (h(user, m_scene, ownerCommand) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region CAN BE GODLIKE
- public bool IsGod(UUID user)
- {
- IsGodHandler handler = OnIsGod;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (IsGodHandler h in list)
- {
- if (h(user, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region EDIT PARCEL
- public bool CanEditParcel(UUID user, ILandObject parcel)
- {
- EditParcelHandler handler = OnEditParcel;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (EditParcelHandler h in list)
- {
- if (h(user, parcel, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region SELL PARCEL
- public bool CanSellParcel(UUID user, ILandObject parcel)
- {
- SellParcelHandler handler = OnSellParcel;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (SellParcelHandler h in list)
- {
- if (h(user, parcel, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- #region ABANDON PARCEL
- public bool CanAbandonParcel(UUID user, ILandObject parcel)
- {
- AbandonParcelHandler handler = OnAbandonParcel;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (AbandonParcelHandler h in list)
- {
- if (h(user, parcel, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- public bool CanReclaimParcel(UUID user, ILandObject parcel)
- {
- ReclaimParcelHandler handler = OnReclaimParcel;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (ReclaimParcelHandler h in list)
- {
- if (h(user, parcel, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanDeedParcel(UUID user, ILandObject parcel)
- {
- DeedParcelHandler handler = OnDeedParcel;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (DeedParcelHandler h in list)
- {
- if (h(user, parcel, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanDeedObject(UUID user, UUID group)
- {
- DeedObjectHandler handler = OnDeedObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (DeedObjectHandler h in list)
- {
- if (h(user, group, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanBuyLand(UUID user, ILandObject parcel)
- {
- BuyLandHandler handler = OnBuyLand;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (BuyLandHandler h in list)
- {
- if (h(user, parcel, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanLinkObject(UUID user, UUID objectID)
- {
- LinkObjectHandler handler = OnLinkObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (LinkObjectHandler h in list)
- {
- if (h(user, objectID) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanDelinkObject(UUID user, UUID objectID)
- {
- DelinkObjectHandler handler = OnDelinkObject;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (DelinkObjectHandler h in list)
- {
- if (h(user, objectID) == false)
- return false;
- }
- }
- return true;
- }
- #endregion
- /// Check whether the specified user is allowed to directly create the given inventory type in a prim's
- /// inventory (e.g. the New Script button in the 1.21 Linden Lab client).
- /// </summary>
- /// <param name="invType"></param>
- /// <param name="objectID"></param>
- /// <param name="userID"></param>
- /// <returns></returns>
- public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
- {
- CreateObjectInventoryHandler handler = OnCreateObjectInventory;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (CreateObjectInventoryHandler h in list)
- {
- if (h(invType, objectID, userID) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
- {
- CopyObjectInventoryHandler handler = OnCopyObjectInventory;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (CopyObjectInventoryHandler h in list)
- {
- if (h(itemID, objectID, userID) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
- {
- DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (DeleteObjectInventoryHandler h in list)
- {
- if (h(itemID, objectID, userID) == false)
- return false;
- }
- }
- return true;
- }
-
- /// <summary>
- /// Check whether the specified user is allowed to create the given inventory type in their inventory.
- /// </summary>
- /// <param name="invType"></param>
- /// <param name="userID"></param>
- /// <returns></returns>
- public bool CanCreateUserInventory(int invType, UUID userID)
- {
- CreateUserInventoryHandler handler = OnCreateUserInventory;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (CreateUserInventoryHandler h in list)
- {
- if (h(invType, userID) == false)
- return false;
- }
- }
- return true;
- }
-
- /// <summary>
- /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
- /// </summary>
- /// <param name="itemID"></param>
- /// <param name="userID"></param>
- /// <returns></returns>
- public bool CanEditUserInventory(UUID itemID, UUID userID)
- {
- EditUserInventoryHandler handler = OnEditUserInventory;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (EditUserInventoryHandler h in list)
- {
- if (h(itemID, userID) == false)
- return false;
- }
- }
- return true;
- }
-
- /// <summary>
- /// Check whether the specified user is allowed to copy the given inventory item from their own inventory.
- /// </summary>
- /// <param name="itemID"></param>
- /// <param name="userID"></param>
- /// <returns></returns>
- public bool CanCopyUserInventory(UUID itemID, UUID userID)
- {
- CopyUserInventoryHandler handler = OnCopyUserInventory;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (CopyUserInventoryHandler h in list)
- {
- if (h(itemID, userID) == false)
- return false;
- }
- }
- return true;
- }
-
- /// <summary>
- /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
- /// </summary>
- /// <param name="itemID"></param>
- /// <param name="userID"></param>
- /// <returns></returns>
- public bool CanDeleteUserInventory(UUID itemID, UUID userID)
- {
- DeleteUserInventoryHandler handler = OnDeleteUserInventory;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (DeleteUserInventoryHandler h in list)
- {
- if (h(itemID, userID) == false)
- return false;
- }
- }
- return true;
- }
-
- public bool CanTeleport(UUID userID)
- {
- TeleportHandler handler = OnTeleport;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (TeleportHandler h in list)
- {
- if (h(userID, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- public bool CanUseObjectReturn(ILandObject landData, uint type , IClientAPI client, List<SceneObjectGroup> retlist)
- {
- UseObjectReturnHandler handler = OnUseObjectReturn;
- if (handler != null)
- {
- Delegate[] list = handler.GetInvocationList();
- foreach (UseObjectReturnHandler h in list)
- {
- if (h(landData, type, client, retlist, m_scene) == false)
- return false;
- }
- }
- return true;
- }
- }
- }
|