12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334 |
- /*
- * 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 OpenSim 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
- {
- public class ScenePermissions
- {
- private Scene m_scene;
- public ScenePermissions(Scene scene)
- {
- m_scene = scene;
- }
- #region Object Permission Checks
- public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectIDID);
- private List<GenerateClientFlagsHandler> GenerateClientFlagsCheckFunctions = new List<GenerateClientFlagsHandler>();
- public void AddGenerateClientFlagsHandler(GenerateClientFlagsHandler delegateFunc)
- {
- if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
- GenerateClientFlagsCheckFunctions.Add(delegateFunc);
- }
- public void RemoveGenerateClientFlagsHandler(GenerateClientFlagsHandler delegateFunc)
- {
- if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
- GenerateClientFlagsCheckFunctions.Remove(delegateFunc);
- }
- public uint GenerateClientFlags(UUID userID, UUID objectID)
- {
- SceneObjectPart part=m_scene.GetSceneObjectPart(objectID);
- if (part == null)
- return 0;
- // libomv will moan about PrimFlags.ObjectYouOfficer being
- // obsolete...
- #pragma warning disable 0612
- uint perms=part.GetEffectiveObjectFlags() |
- (uint)PrimFlags.ObjectModify |
- (uint)PrimFlags.ObjectCopy |
- (uint)PrimFlags.ObjectMove |
- (uint)PrimFlags.ObjectTransfer |
- (uint)PrimFlags.ObjectYouOwner |
- (uint)PrimFlags.ObjectAnyOwner |
- (uint)PrimFlags.ObjectOwnerModify |
- (uint)PrimFlags.ObjectYouOfficer;
- #pragma warning restore 0612
- foreach (GenerateClientFlagsHandler check in GenerateClientFlagsCheckFunctions)
- {
- perms &= check(userID, objectID);
- }
- return perms;
- }
- public delegate void SetBypassPermissionsHandler(bool value);
- private List<SetBypassPermissionsHandler> SetBypassPermissionsCheckFunctions = new List<SetBypassPermissionsHandler>();
- public void AddSetBypassPermissionsHandler(SetBypassPermissionsHandler delegateFunc)
- {
- if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
- SetBypassPermissionsCheckFunctions.Add(delegateFunc);
- }
- public void RemoveSetBypassPermissionsHandler(SetBypassPermissionsHandler delegateFunc)
- {
- if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
- SetBypassPermissionsCheckFunctions.Remove(delegateFunc);
- }
- public void SetBypassPermissions(bool value)
- {
- foreach (SetBypassPermissionsHandler check in SetBypassPermissionsCheckFunctions)
- {
- check(value);
- }
- }
- public delegate bool BypassPermissionsHandler();
- private List<BypassPermissionsHandler> BypassPermissionsCheckFunctions = new List<BypassPermissionsHandler>();
- public void AddBypassPermissionsHandler(BypassPermissionsHandler delegateFunc)
- {
- if (!BypassPermissionsCheckFunctions.Contains(delegateFunc))
- BypassPermissionsCheckFunctions.Add(delegateFunc);
- }
- public void RemoveBypassPermissionsHandler(BypassPermissionsHandler delegateFunc)
- {
- if (BypassPermissionsCheckFunctions.Contains(delegateFunc))
- BypassPermissionsCheckFunctions.Remove(delegateFunc);
- }
- public bool BypassPermissions()
- {
- foreach (BypassPermissionsHandler check in BypassPermissionsCheckFunctions)
- {
- if (check() == false)
- {
- return false;
- }
- }
- return true;
- }
- public delegate bool PropagatePermissionsHandler();
- private List<PropagatePermissionsHandler> PropagatePermissionsCheckFunctions = new List<PropagatePermissionsHandler>();
- public void AddPropagatePermissionsHandler(PropagatePermissionsHandler delegateFunc)
- {
- if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc))
- PropagatePermissionsCheckFunctions.Add(delegateFunc);
- }
- public void RemovePropagatePermissionsHandler(PropagatePermissionsHandler delegateFunc)
- {
- if (PropagatePermissionsCheckFunctions.Contains(delegateFunc))
- PropagatePermissionsCheckFunctions.Remove(delegateFunc);
- }
- public bool PropagatePermissions()
- {
- foreach (PropagatePermissionsHandler check in PropagatePermissionsCheckFunctions)
- {
- if (check() == false)
- {
- return false;
- }
- }
- return true;
- }
- #region REZ OBJECT
- public delegate bool CanRezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
- private List<CanRezObjectHandler> CanRezObjectCheckFunctions = new List<CanRezObjectHandler>();
- public void AddRezObjectHandler(CanRezObjectHandler delegateFunc)
- {
- if (!CanRezObjectCheckFunctions.Contains(delegateFunc))
- CanRezObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveRezObjectHandler(CanRezObjectHandler delegateFunc)
- {
- if (CanRezObjectCheckFunctions.Contains(delegateFunc))
- CanRezObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition)
- {
- foreach (CanRezObjectHandler check in CanRezObjectCheckFunctions)
- {
- if (check(objectCount, owner,objectPosition, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region DELETE OBJECT
- public delegate bool CanDeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
- private List<CanDeleteObjectHandler> CanDeleteObjectCheckFunctions = new List<CanDeleteObjectHandler>();
- public void AddDeleteObjectHandler(CanDeleteObjectHandler delegateFunc)
- {
- if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc))
- CanDeleteObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveDeleteObjectHandler(CanDeleteObjectHandler delegateFunc)
- {
- if (CanDeleteObjectCheckFunctions.Contains(delegateFunc))
- CanDeleteObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanDeleteObject(UUID objectID, UUID deleter)
- {
- foreach (CanDeleteObjectHandler check in CanDeleteObjectCheckFunctions)
- {
- if (check(objectID,deleter,m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region TAKE OBJECT
- public delegate bool CanTakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
- private List<CanTakeObjectHandler> CanTakeObjectCheckFunctions = new List<CanTakeObjectHandler>();
- public void AddTakeObjectHandler(CanTakeObjectHandler delegateFunc)
- {
- if (!CanTakeObjectCheckFunctions.Contains(delegateFunc))
- CanTakeObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveTakeObjectHandler(CanTakeObjectHandler delegateFunc)
- {
- if (CanTakeObjectCheckFunctions.Contains(delegateFunc))
- CanTakeObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID)
- {
- foreach (CanTakeObjectHandler check in CanTakeObjectCheckFunctions)
- {
- if (check(objectID, AvatarTakingUUID, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region TAKE COPY OBJECT
- public delegate bool CanTakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
- private List<CanTakeCopyObjectHandler> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObjectHandler>();
- public void AddTakeCopyObjectHandler(CanTakeCopyObjectHandler delegateFunc)
- {
- if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
- CanTakeCopyObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveTakeCopyObjectHandler(CanTakeCopyObjectHandler delegateFunc)
- {
- if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
- CanTakeCopyObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanTakeCopyObject(UUID objectID, UUID userID)
- {
- foreach (CanTakeCopyObjectHandler check in CanTakeCopyObjectCheckFunctions)
- {
- if (check(objectID,userID,m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region DUPLICATE OBJECT
- public delegate bool CanDuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
- private List<CanDuplicateObjectHandler> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObjectHandler>();
- public void AddDuplicateObjectHandler(CanDuplicateObjectHandler delegateFunc)
- {
- if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
- CanDuplicateObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveDuplicateObjectHandler(CanDuplicateObjectHandler delegateFunc)
- {
- if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
- CanDuplicateObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition)
- {
- foreach (CanDuplicateObjectHandler check in CanDuplicateObjectCheckFunctions)
- {
- if (check(objectCount, objectID, owner, m_scene, objectPosition) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region EDIT OBJECT
- public delegate bool CanEditObjectHandler(UUID objectID, UUID editorID, Scene scene);
- private List<CanEditObjectHandler> CanEditObjectCheckFunctions = new List<CanEditObjectHandler>();
- public void AddEditObjectHandler(CanEditObjectHandler delegateFunc)
- {
- if (!CanEditObjectCheckFunctions.Contains(delegateFunc))
- CanEditObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveEditObjectHandler(CanEditObjectHandler delegateFunc)
- {
- if (CanEditObjectCheckFunctions.Contains(delegateFunc))
- CanEditObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanEditObject(UUID objectID, UUID editorID)
- {
- foreach (CanEditObjectHandler check in CanEditObjectCheckFunctions)
- {
- if (check(objectID, editorID, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- public delegate bool CanEditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
- private List<CanEditObjectInventoryHandler> CanEditObjectInventoryCheckFunctions = new List<CanEditObjectInventoryHandler>();
- public void AddEditObjectInventoryHandler(CanEditObjectInventoryHandler delegateFunc)
- {
- if (!CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
- CanEditObjectInventoryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveEditObjectInventoryHandler(CanEditObjectInventoryHandler delegateFunc)
- {
- if (CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
- CanEditObjectInventoryCheckFunctions.Remove(delegateFunc);
- }
- public bool CanEditObjectInventory(UUID objectID, UUID editorID)
- {
- foreach (CanEditObjectInventoryHandler check in CanEditObjectInventoryCheckFunctions)
- {
- if (check(objectID, editorID, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region MOVE OBJECT
- public delegate bool CanMoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
- private List<CanMoveObjectHandler> CanMoveObjectCheckFunctions = new List<CanMoveObjectHandler>();
- public void AddMoveObjectHandler(CanMoveObjectHandler delegateFunc)
- {
- if (!CanMoveObjectCheckFunctions.Contains(delegateFunc))
- CanMoveObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveMoveObjectHandler(CanMoveObjectHandler delegateFunc)
- {
- if (CanMoveObjectCheckFunctions.Contains(delegateFunc))
- CanMoveObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanMoveObject(UUID objectID, UUID moverID)
- {
- foreach (CanMoveObjectHandler check in CanMoveObjectCheckFunctions)
- {
- if (check(objectID,moverID,m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region OBJECT ENTRY
- public delegate bool CanObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
- private List<CanObjectEntryHandler> CanObjectEntryCheckFunctions = new List<CanObjectEntryHandler>();
- public void AddObjectEntryHandler(CanObjectEntryHandler delegateFunc)
- {
- if (!CanObjectEntryCheckFunctions.Contains(delegateFunc))
- CanObjectEntryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveObjectEntryHandler(CanObjectEntryHandler delegateFunc)
- {
- if (CanObjectEntryCheckFunctions.Contains(delegateFunc))
- CanObjectEntryCheckFunctions.Remove(delegateFunc);
- }
- public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint)
- {
- foreach (CanObjectEntryHandler check in CanObjectEntryCheckFunctions)
- {
- if (check(objectID, enteringRegion, newPoint, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region RETURN OBJECT
- public delegate bool CanReturnObjectHandler(UUID objectID, UUID returnerID, Scene scene);
- private List<CanReturnObjectHandler> CanReturnObjectCheckFunctions = new List<CanReturnObjectHandler>();
- public void AddReturnObjectHandler(CanReturnObjectHandler delegateFunc)
- {
- if (!CanReturnObjectCheckFunctions.Contains(delegateFunc))
- CanReturnObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveReturnObjectHandler(CanReturnObjectHandler delegateFunc)
- {
- if (CanReturnObjectCheckFunctions.Contains(delegateFunc))
- CanReturnObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanReturnObject(UUID objectID, UUID returnerID)
- {
- foreach (CanReturnObjectHandler check in CanReturnObjectCheckFunctions)
- {
- if (check(objectID,returnerID,m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region INSTANT MESSAGE
- public delegate bool CanInstantMessageHandler(UUID user, UUID target, Scene startScene);
- private List<CanInstantMessageHandler> CanInstantMessageCheckFunctions = new List<CanInstantMessageHandler>();
- public void AddInstantMessageHandler(CanInstantMessageHandler delegateFunc)
- {
- if (!CanInstantMessageCheckFunctions.Contains(delegateFunc))
- CanInstantMessageCheckFunctions.Add(delegateFunc);
- }
- public void RemoveInstantMessageHandler(CanInstantMessageHandler delegateFunc)
- {
- if (CanInstantMessageCheckFunctions.Contains(delegateFunc))
- CanInstantMessageCheckFunctions.Remove(delegateFunc);
- }
- public bool CanInstantMessage(UUID user, UUID target)
- {
- foreach (CanInstantMessageHandler check in CanInstantMessageCheckFunctions)
- {
- if (check(user, target, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region INVENTORY TRANSFER
- public delegate bool CanInventoryTransferHandler(UUID user, UUID target, Scene startScene);
- private List<CanInventoryTransferHandler> CanInventoryTransferCheckFunctions = new List<CanInventoryTransferHandler>();
- public void AddInventoryTransferHandler(CanInventoryTransferHandler delegateFunc)
- {
- if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc))
- CanInventoryTransferCheckFunctions.Add(delegateFunc);
- }
- public void RemoveInventoryTransferHandler(CanInventoryTransferHandler delegateFunc)
- {
- if (CanInventoryTransferCheckFunctions.Contains(delegateFunc))
- CanInventoryTransferCheckFunctions.Remove(delegateFunc);
- }
- public bool CanInventoryTransfer(UUID user, UUID target)
- {
- foreach (CanInventoryTransferHandler check in CanInventoryTransferCheckFunctions)
- {
- if (check(user, target, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region VIEW SCRIPT
- public delegate bool CanViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
- private List<CanViewScriptHandler> CanViewScriptCheckFunctions = new List<CanViewScriptHandler>();
- public void AddViewScriptHandler(CanViewScriptHandler delegateFunc)
- {
- if (!CanViewScriptCheckFunctions.Contains(delegateFunc))
- CanViewScriptCheckFunctions.Add(delegateFunc);
- }
- public void RemoveViewScriptHandler(CanViewScriptHandler delegateFunc)
- {
- if (CanViewScriptCheckFunctions.Contains(delegateFunc))
- CanViewScriptCheckFunctions.Remove(delegateFunc);
- }
- public bool CanViewScript(UUID script, UUID objectID, UUID user)
- {
- foreach (CanViewScriptHandler check in CanViewScriptCheckFunctions)
- {
- if (check(script, objectID, user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- public delegate bool CanViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
- private List<CanViewNotecardHandler> CanViewNotecardCheckFunctions = new List<CanViewNotecardHandler>();
- public void AddViewNotecardHandler(CanViewNotecardHandler delegateFunc)
- {
- if (!CanViewNotecardCheckFunctions.Contains(delegateFunc))
- CanViewNotecardCheckFunctions.Add(delegateFunc);
- }
- public void RemoveViewNotecardHandler(CanViewNotecardHandler delegateFunc)
- {
- if (CanViewNotecardCheckFunctions.Contains(delegateFunc))
- CanViewNotecardCheckFunctions.Remove(delegateFunc);
- }
- public bool CanViewNotecard(UUID script, UUID objectID, UUID user)
- {
- foreach (CanViewNotecardHandler check in CanViewNotecardCheckFunctions)
- {
- if (check(script, objectID, user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region EDIT SCRIPT
- public delegate bool CanEditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
- private List<CanEditScriptHandler> CanEditScriptCheckFunctions = new List<CanEditScriptHandler>();
- public void AddEditScriptHandler(CanEditScriptHandler delegateFunc)
- {
- if (!CanEditScriptCheckFunctions.Contains(delegateFunc))
- CanEditScriptCheckFunctions.Add(delegateFunc);
- }
- public void RemoveEditScriptHandler(CanEditScriptHandler delegateFunc)
- {
- if (CanEditScriptCheckFunctions.Contains(delegateFunc))
- CanEditScriptCheckFunctions.Remove(delegateFunc);
- }
- public bool CanEditScript(UUID script, UUID objectID, UUID user)
- {
- foreach (CanEditScriptHandler check in CanEditScriptCheckFunctions)
- {
- if (check(script, objectID, user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- public delegate bool CanEditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
- private List<CanEditNotecardHandler> CanEditNotecardCheckFunctions = new List<CanEditNotecardHandler>();
- public void AddEditNotecardHandler(CanEditNotecardHandler delegateFunc)
- {
- if (!CanEditNotecardCheckFunctions.Contains(delegateFunc))
- CanEditNotecardCheckFunctions.Add(delegateFunc);
- }
- public void RemoveEditNotecardHandler(CanEditNotecardHandler delegateFunc)
- {
- if (CanEditNotecardCheckFunctions.Contains(delegateFunc))
- CanEditNotecardCheckFunctions.Remove(delegateFunc);
- }
- public bool CanEditNotecard(UUID script, UUID objectID, UUID user)
- {
- foreach (CanEditNotecardHandler check in CanEditNotecardCheckFunctions)
- {
- if (check(script, objectID, user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region RUN SCRIPT (When Script Placed in Object)
- public delegate bool CanRunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
- private List<CanRunScriptHandler> CanRunScriptCheckFunctions = new List<CanRunScriptHandler>();
- public void AddRunScriptHandler(CanRunScriptHandler delegateFunc)
- {
- if (!CanRunScriptCheckFunctions.Contains(delegateFunc))
- CanRunScriptCheckFunctions.Add(delegateFunc);
- }
- public void RemoveRunScriptHandler(CanRunScriptHandler delegateFunc)
- {
- if (CanRunScriptCheckFunctions.Contains(delegateFunc))
- CanRunScriptCheckFunctions.Remove(delegateFunc);
- }
- public bool CanRunScript(UUID script, UUID objectID, UUID user)
- {
- foreach (CanRunScriptHandler check in CanRunScriptCheckFunctions)
- {
- if (check(script, objectID, user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region START SCRIPT (When Script run box is Checked after placed in object)
- public delegate bool CanStartScriptHandler(UUID script, UUID user, Scene scene);
- private List<CanStartScriptHandler> CanStartScriptCheckFunctions = new List<CanStartScriptHandler>();
- public void AddStartScriptHandler(CanStartScriptHandler delegateFunc)
- {
- if (!CanStartScriptCheckFunctions.Contains(delegateFunc))
- CanStartScriptCheckFunctions.Add(delegateFunc);
- }
- public void RemoveStartScriptHandler(CanStartScriptHandler delegateFunc)
- {
- if (CanStartScriptCheckFunctions.Contains(delegateFunc))
- CanStartScriptCheckFunctions.Remove(delegateFunc);
- }
- public bool CanStartScript(UUID script, UUID user)
- {
- foreach (CanStartScriptHandler check in CanStartScriptCheckFunctions)
- {
- if (check(script, user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region STOP SCRIPT (When Script run box is unchecked after placed in object)
- public delegate bool CanStopScriptHandler(UUID script, UUID user, Scene scene);
- private List<CanStopScriptHandler> CanStopScriptCheckFunctions = new List<CanStopScriptHandler>();
- public void AddStopScriptHandler(CanStopScriptHandler delegateFunc)
- {
- if (!CanStopScriptCheckFunctions.Contains(delegateFunc))
- CanStopScriptCheckFunctions.Add(delegateFunc);
- }
- public void RemoveStopScriptHandler(CanStopScriptHandler delegateFunc)
- {
- if (CanStopScriptCheckFunctions.Contains(delegateFunc))
- CanStopScriptCheckFunctions.Remove(delegateFunc);
- }
- public bool CanStopScript(UUID script, UUID user)
- {
- foreach (CanStopScriptHandler check in CanStopScriptCheckFunctions)
- {
- if (check(script, user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region RESET SCRIPT
- public delegate bool CanResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
- private List<CanResetScriptHandler> CanResetScriptCheckFunctions = new List<CanResetScriptHandler>();
- public void AddResetScriptHandler(CanResetScriptHandler delegateFunc)
- {
- if (!CanResetScriptCheckFunctions.Contains(delegateFunc))
- CanResetScriptCheckFunctions.Add(delegateFunc);
- }
- public void RemoveResetScriptHandler(CanResetScriptHandler delegateFunc)
- {
- if (CanResetScriptCheckFunctions.Contains(delegateFunc))
- CanResetScriptCheckFunctions.Remove(delegateFunc);
- }
- public bool CanResetScript(UUID prim, UUID script, UUID user)
- {
- foreach (CanResetScriptHandler check in CanResetScriptCheckFunctions)
- {
- if (check(prim, script, user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region TERRAFORM LAND
- public delegate bool CanTerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
- private List<CanTerraformLandHandler> CanTerraformLandCheckFunctions = new List<CanTerraformLandHandler>();
- public void AddTerraformLandHandler(CanTerraformLandHandler delegateFunc)
- {
- if (!CanTerraformLandCheckFunctions.Contains(delegateFunc))
- CanTerraformLandCheckFunctions.Add(delegateFunc);
- }
- public void RemoveTerraformLandHandler(CanTerraformLandHandler delegateFunc)
- {
- if (CanTerraformLandCheckFunctions.Contains(delegateFunc))
- CanTerraformLandCheckFunctions.Remove(delegateFunc);
- }
- public bool CanTerraformLand(UUID user, Vector3 pos)
- {
- foreach (CanTerraformLandHandler check in CanTerraformLandCheckFunctions)
- {
- if (check(user, pos, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region RUN CONSOLE COMMAND
- public delegate bool CanRunConsoleCommandHandler(UUID user, Scene requestFromScene);
- private List<CanRunConsoleCommandHandler> CanRunConsoleCommandCheckFunctions = new List<CanRunConsoleCommandHandler>();
- public void AddRunConsoleCommandHandler(CanRunConsoleCommandHandler delegateFunc)
- {
- if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
- CanRunConsoleCommandCheckFunctions.Add(delegateFunc);
- }
- public void RemoveRunConsoleCommandHandler(CanRunConsoleCommandHandler delegateFunc)
- {
- if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
- CanRunConsoleCommandCheckFunctions.Remove(delegateFunc);
- }
- public bool CanRunConsoleCommand(UUID user)
- {
- foreach (CanRunConsoleCommandHandler check in CanRunConsoleCommandCheckFunctions)
- {
- if (check(user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region CAN ISSUE ESTATE COMMAND
- public delegate bool CanIssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
- private List<CanIssueEstateCommandHandler> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommandHandler>();
- public void AddIssueEstateCommandHandler(CanIssueEstateCommandHandler delegateFunc)
- {
- if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
- CanIssueEstateCommandCheckFunctions.Add(delegateFunc);
- }
- public void RemoveIssueEstateCommandHandler(CanIssueEstateCommandHandler delegateFunc)
- {
- if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
- CanIssueEstateCommandCheckFunctions.Remove(delegateFunc);
- }
- public bool CanIssueEstateCommand(UUID user, bool ownerCommand)
- {
- foreach (CanIssueEstateCommandHandler check in CanIssueEstateCommandCheckFunctions)
- {
- if (check(user, m_scene, ownerCommand) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region CAN BE GODLIKE
- public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
- private List<IsGodHandler> IsGodCheckFunctions = new List<IsGodHandler>();
- public void AddIsGodHandler(IsGodHandler delegateFunc)
- {
- if (!IsGodCheckFunctions.Contains(delegateFunc))
- IsGodCheckFunctions.Add(delegateFunc);
- }
- public void RemoveIsGodHandler(IsGodHandler delegateFunc)
- {
- if (IsGodCheckFunctions.Contains(delegateFunc))
- IsGodCheckFunctions.Remove(delegateFunc);
- }
- public bool IsGod(UUID user)
- {
- foreach (IsGodHandler check in IsGodCheckFunctions)
- {
- if (check(user, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region EDIT PARCEL
- public delegate bool CanEditParcelHandler(UUID user, ILandObject parcel, Scene scene);
- private List<CanEditParcelHandler> CanEditParcelCheckFunctions = new List<CanEditParcelHandler>();
- public void AddEditParcelHandler(CanEditParcelHandler delegateFunc)
- {
- if (!CanEditParcelCheckFunctions.Contains(delegateFunc))
- CanEditParcelCheckFunctions.Add(delegateFunc);
- }
- public void RemoveEditParcelHandler(CanEditParcelHandler delegateFunc)
- {
- if (CanEditParcelCheckFunctions.Contains(delegateFunc))
- CanEditParcelCheckFunctions.Remove(delegateFunc);
- }
- public bool CanEditParcel(UUID user, ILandObject parcel)
- {
- foreach (CanEditParcelHandler check in CanEditParcelCheckFunctions)
- {
- if (check(user, parcel, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region SELL PARCEL
- public delegate bool CanSellParcelHandler(UUID user, ILandObject parcel, Scene scene);
- private List<CanSellParcelHandler> CanSellParcelCheckFunctions = new List<CanSellParcelHandler>();
- public void AddSellParcelHandler(CanSellParcelHandler delegateFunc)
- {
- if (!CanSellParcelCheckFunctions.Contains(delegateFunc))
- CanSellParcelCheckFunctions.Add(delegateFunc);
- }
- public void RemoveSellParcelHandler(CanSellParcelHandler delegateFunc)
- {
- if (CanSellParcelCheckFunctions.Contains(delegateFunc))
- CanSellParcelCheckFunctions.Remove(delegateFunc);
- }
- public bool CanSellParcel(UUID user, ILandObject parcel)
- {
- foreach (CanSellParcelHandler check in CanSellParcelCheckFunctions)
- {
- if (check(user, parcel, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region ABANDON PARCEL
- public delegate bool CanAbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
- private List<CanAbandonParcelHandler> CanAbandonParcelCheckFunctions = new List<CanAbandonParcelHandler>();
- public void AddAbandonParcelHandler(CanAbandonParcelHandler delegateFunc)
- {
- if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc))
- CanAbandonParcelCheckFunctions.Add(delegateFunc);
- }
- public void RemoveAbandonParcelHandler(CanAbandonParcelHandler delegateFunc)
- {
- if (CanAbandonParcelCheckFunctions.Contains(delegateFunc))
- CanAbandonParcelCheckFunctions.Remove(delegateFunc);
- }
- public bool CanAbandonParcel(UUID user, ILandObject parcel)
- {
- foreach (CanAbandonParcelHandler check in CanAbandonParcelCheckFunctions)
- {
- if (check(user, parcel, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- public delegate bool CanReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
- private List<CanReclaimParcelHandler> CanReclaimParcelCheckFunctions = new List<CanReclaimParcelHandler>();
- public void AddReclaimParcelHandler(CanReclaimParcelHandler delegateFunc)
- {
- if (!CanReclaimParcelCheckFunctions.Contains(delegateFunc))
- CanReclaimParcelCheckFunctions.Add(delegateFunc);
- }
- public void RemoveReclaimParcelHandler(CanReclaimParcelHandler delegateFunc)
- {
- if (CanReclaimParcelCheckFunctions.Contains(delegateFunc))
- CanReclaimParcelCheckFunctions.Remove(delegateFunc);
- }
- public bool CanReclaimParcel(UUID user, ILandObject parcel)
- {
- foreach (CanReclaimParcelHandler check in CanReclaimParcelCheckFunctions)
- {
- if (check(user, parcel, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- public delegate bool CanBuyLandHandler(UUID user, ILandObject parcel, Scene scene);
- private List<CanBuyLandHandler> CanBuyLandCheckFunctions = new List<CanBuyLandHandler>();
- public void AddCanBuyLandHandler(CanBuyLandHandler delegateFunc)
- {
- if (!CanBuyLandCheckFunctions.Contains(delegateFunc))
- CanBuyLandCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanBuyLandHandler(CanBuyLandHandler delegateFunc)
- {
- if (CanBuyLandCheckFunctions.Contains(delegateFunc))
- CanBuyLandCheckFunctions.Remove(delegateFunc);
- }
- public bool CanBuyLand(UUID user, ILandObject parcel)
- {
- foreach (CanBuyLandHandler check in CanBuyLandCheckFunctions)
- {
- if (check(user, parcel, m_scene) == false)
- {
- return false;
- }
- }
- return true;
- }
- public delegate bool CanLinkObjectHandler(UUID user, UUID objectID);
- private List<CanLinkObjectHandler> CanLinkObjectCheckFunctions = new List<CanLinkObjectHandler>();
- public void AddCanLinkObjectHandler(CanLinkObjectHandler delegateFunc)
- {
- if (!CanLinkObjectCheckFunctions.Contains(delegateFunc))
- CanLinkObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanLinkObjectHandler(CanLinkObjectHandler delegateFunc)
- {
- if (CanLinkObjectCheckFunctions.Contains(delegateFunc))
- CanLinkObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanLinkObject(UUID user, UUID objectID)
- {
- foreach (CanLinkObjectHandler check in CanLinkObjectCheckFunctions)
- {
- if (check(user, objectID) == false)
- {
- return false;
- }
- }
- return true;
- }
- public delegate bool CanDelinkObjectHandler(UUID user, UUID objectID);
- private List<CanDelinkObjectHandler> CanDelinkObjectCheckFunctions = new List<CanDelinkObjectHandler>();
- public void AddCanDelinkObjectHandler(CanDelinkObjectHandler delegateFunc)
- {
- if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc))
- CanDelinkObjectCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanDelinkObjectHandler(CanDelinkObjectHandler delegateFunc)
- {
- if (CanDelinkObjectCheckFunctions.Contains(delegateFunc))
- CanDelinkObjectCheckFunctions.Remove(delegateFunc);
- }
- public bool CanDelinkObject(UUID user, UUID objectID)
- {
- foreach (CanDelinkObjectHandler check in CanDelinkObjectCheckFunctions)
- {
- if (check(user, objectID) == false)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- public delegate bool CanCreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
- private List<CanCreateObjectInventoryHandler> CanCreateObjectInventoryCheckFunctions
- = new List<CanCreateObjectInventoryHandler>();
-
- public void AddCanCreateObjectInventoryHandler(CanCreateObjectInventoryHandler delegateFunc)
- {
- if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc))
- CanCreateObjectInventoryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanCreateObjectInventoryHandler(CanCreateObjectInventoryHandler delegateFunc)
- {
- if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc))
- CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc);
- }
- /// <summary>
- /// 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)
- {
- foreach (CanCreateObjectInventoryHandler check in CanCreateObjectInventoryCheckFunctions)
- {
- if (check(invType, objectID, userID) == false)
- {
- return false;
- }
- }
-
- return true;
- }
- public delegate bool CanCopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
- private List<CanCopyObjectInventoryHandler> CanCopyObjectInventoryCheckFunctions = new List<CanCopyObjectInventoryHandler>();
- public void AddCanCopyObjectInventoryHandler(CanCopyObjectInventoryHandler delegateFunc)
- {
- if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc))
- CanCopyObjectInventoryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanCopyObjectInventoryHandler(CanCopyObjectInventoryHandler delegateFunc)
- {
- if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc))
- CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc);
- }
-
- public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
- {
- foreach (CanCopyObjectInventoryHandler check in CanCopyObjectInventoryCheckFunctions)
- {
- if (check(itemID, objectID, userID) == false)
- {
- return false;
- }
- }
- return true;
- }
- public delegate bool CanDeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
- private List<CanDeleteObjectInventoryHandler> CanDeleteObjectInventoryCheckFunctions
- = new List<CanDeleteObjectInventoryHandler>();
- public void AddCanDeleteObjectInventoryHandler(CanDeleteObjectInventoryHandler delegateFunc)
- {
- if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc))
- CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanDeleteObjectInventoryHandler(CanDeleteObjectInventoryHandler delegateFunc)
- {
- if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc))
- CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc);
- }
- public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
- {
- foreach (CanDeleteObjectInventoryHandler check in CanDeleteObjectInventoryCheckFunctions)
- {
- if (check(itemID, objectID, userID) == false)
- {
- return false;
- }
- }
-
- return true;
- }
-
- public delegate bool CanCreateUserInventoryHandler(int invType, UUID userID);
- private List<CanCreateUserInventoryHandler> CanCreateUserInventoryCheckFunctions
- = new List<CanCreateUserInventoryHandler>();
-
- public void AddCanCreateUserInventoryHandler(CanCreateUserInventoryHandler delegateFunc)
- {
- if (!CanCreateUserInventoryCheckFunctions.Contains(delegateFunc))
- CanCreateUserInventoryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanCreateUserInventoryHandler(CanCreateUserInventoryHandler delegateFunc)
- {
- if (CanCreateUserInventoryCheckFunctions.Contains(delegateFunc))
- CanCreateUserInventoryCheckFunctions.Remove(delegateFunc);
- }
- /// <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)
- {
- foreach (CanCreateUserInventoryHandler check in CanCreateUserInventoryCheckFunctions)
- {
- if (check(invType, userID) == false)
- {
- return false;
- }
- }
-
- return true;
- }
-
- public delegate bool CanEditUserInventoryHandler(UUID itemID, UUID userID);
- private List<CanEditUserInventoryHandler> CanEditUserInventoryCheckFunctions
- = new List<CanEditUserInventoryHandler>();
-
- public void AddCanEditUserInventoryHandler(CanEditUserInventoryHandler delegateFunc)
- {
- if (!CanEditUserInventoryCheckFunctions.Contains(delegateFunc))
- CanEditUserInventoryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanEditUserInventoryHandler(CanEditUserInventoryHandler delegateFunc)
- {
- if (CanEditUserInventoryCheckFunctions.Contains(delegateFunc))
- CanEditUserInventoryCheckFunctions.Remove(delegateFunc);
- }
- /// <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)
- {
- foreach (CanEditUserInventoryHandler check in CanEditUserInventoryCheckFunctions)
- {
- if (check(itemID, userID) == false)
- {
- return false;
- }
- }
-
- return true;
- }
-
- public delegate bool CanCopyUserInventoryHandler(UUID itemID, UUID userID);
- private List<CanCopyUserInventoryHandler> CanCopyUserInventoryCheckFunctions
- = new List<CanCopyUserInventoryHandler>();
-
- public void AddCanCopyUserInventoryHandler(CanCopyUserInventoryHandler delegateFunc)
- {
- if (!CanCopyUserInventoryCheckFunctions.Contains(delegateFunc))
- CanCopyUserInventoryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanCopyUserInventoryHandler(CanCopyUserInventoryHandler delegateFunc)
- {
- if (CanCopyUserInventoryCheckFunctions.Contains(delegateFunc))
- CanCopyUserInventoryCheckFunctions.Remove(delegateFunc);
- }
-
- /// <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)
- {
- foreach (CanCopyUserInventoryHandler check in CanCopyUserInventoryCheckFunctions)
- {
- if (check(itemID, userID) == false)
- {
- return false;
- }
- }
-
- return true;
- }
-
- public delegate bool CanDeleteUserInventoryHandler(UUID itemID, UUID userID);
- private List<CanDeleteUserInventoryHandler> CanDeleteUserInventoryCheckFunctions
- = new List<CanDeleteUserInventoryHandler>();
-
- public void AddCanDeleteUserInventoryHandler(CanDeleteUserInventoryHandler delegateFunc)
- {
- if (!CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc))
- CanDeleteUserInventoryCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanDeleteUserInventoryHandler(CanDeleteUserInventoryHandler delegateFunc)
- {
- if (CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc))
- CanDeleteUserInventoryCheckFunctions.Remove(delegateFunc);
- }
- /// <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)
- {
- foreach (CanDeleteUserInventoryHandler check in CanDeleteUserInventoryCheckFunctions)
- {
- if (check(itemID, userID) == false)
- {
- return false;
- }
- }
-
- return true;
- }
-
- public delegate bool CanTeleportHandler(UUID userID);
- private List<CanTeleportHandler> CanTeleportCheckFunctions = new List<CanTeleportHandler>();
- public void AddCanTeleportHandler(CanTeleportHandler delegateFunc)
- {
- if (!CanTeleportCheckFunctions.Contains(delegateFunc))
- CanTeleportCheckFunctions.Add(delegateFunc);
- }
- public void RemoveCanTeleportHandler(CanTeleportHandler delegateFunc)
- {
- if (CanTeleportCheckFunctions.Contains(delegateFunc))
- CanTeleportCheckFunctions.Remove(delegateFunc);
- }
- public bool CanTeleport(UUID userID)
- {
- foreach (CanTeleportHandler check in CanTeleportCheckFunctions)
- {
- if (check(userID) == false)
- {
- return false;
- }
- }
- return true;
- }
- }
- }
|