From 7223b63563f28f6fe8044bdabcd1b9900d28c54a Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Tue, 27 Mar 2012 22:09:58 +0200 Subject: User level based restrictions for HyperGrid teleports, asset uploads, group creations and getting contacted from other grids. Incoming HyperGrid teleports can also be restricted to local users. --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 34 +++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ed3430a..8ec2f20 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -111,6 +111,7 @@ namespace OpenSim.Region.ClientStack.Linden private IAssetService m_assetService; private bool m_dumpAssetsToFile = false; private string m_regionName; + private int m_levelUpload = 0; public BunchOfCaps(Scene scene, Caps caps) { @@ -121,7 +122,10 @@ namespace OpenSim.Region.ClientStack.Linden { IConfig sconfig = config.Configs["Startup"]; if (sconfig != null) + { m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); + m_levelUpload = sconfig.GetInt("LevelUpload", 0); + } } m_assetService = m_Scene.AssetService; @@ -357,21 +361,37 @@ namespace OpenSim.Region.ClientStack.Linden llsdRequest.asset_type == "animation" || llsdRequest.asset_type == "sound") { + ScenePresence avatar = null; IClientAPI client = null; - IScene scene = null; - if (GetClient != null) + m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); + + // check user level + if (avatar != null) { - client = GetClient(m_HostCapsObj.AgentID); - scene = client.Scene; + client = avatar.ControllingClient; + + if (avatar.UserLevel < m_levelUpload) + { + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); - IMoneyModule mm = scene.RequestModuleInterface(); + LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); + errorResponse.uploader = ""; + errorResponse.state = "error"; + return errorResponse; + } + } + + // check funds + if (client != null) + { + IMoneyModule mm = m_Scene.RequestModuleInterface(); if (mm != null) { if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; -- cgit v1.1