diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 34 |
1 files changed, 27 insertions, 7 deletions
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 | |||
111 | private IAssetService m_assetService; | 111 | private IAssetService m_assetService; |
112 | private bool m_dumpAssetsToFile = false; | 112 | private bool m_dumpAssetsToFile = false; |
113 | private string m_regionName; | 113 | private string m_regionName; |
114 | private int m_levelUpload = 0; | ||
114 | 115 | ||
115 | public BunchOfCaps(Scene scene, Caps caps) | 116 | public BunchOfCaps(Scene scene, Caps caps) |
116 | { | 117 | { |
@@ -121,7 +122,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
121 | { | 122 | { |
122 | IConfig sconfig = config.Configs["Startup"]; | 123 | IConfig sconfig = config.Configs["Startup"]; |
123 | if (sconfig != null) | 124 | if (sconfig != null) |
125 | { | ||
124 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | 126 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
127 | m_levelUpload = sconfig.GetInt("LevelUpload", 0); | ||
128 | } | ||
125 | } | 129 | } |
126 | 130 | ||
127 | m_assetService = m_Scene.AssetService; | 131 | m_assetService = m_Scene.AssetService; |
@@ -357,21 +361,37 @@ namespace OpenSim.Region.ClientStack.Linden | |||
357 | llsdRequest.asset_type == "animation" || | 361 | llsdRequest.asset_type == "animation" || |
358 | llsdRequest.asset_type == "sound") | 362 | llsdRequest.asset_type == "sound") |
359 | { | 363 | { |
364 | ScenePresence avatar = null; | ||
360 | IClientAPI client = null; | 365 | IClientAPI client = null; |
361 | IScene scene = null; | 366 | m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); |
362 | if (GetClient != null) | 367 | |
368 | // check user level | ||
369 | if (avatar != null) | ||
363 | { | 370 | { |
364 | client = GetClient(m_HostCapsObj.AgentID); | 371 | client = avatar.ControllingClient; |
365 | scene = client.Scene; | 372 | |
373 | if (avatar.UserLevel < m_levelUpload) | ||
374 | { | ||
375 | if (client != null) | ||
376 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | ||
366 | 377 | ||
367 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | 378 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
379 | errorResponse.uploader = ""; | ||
380 | errorResponse.state = "error"; | ||
381 | return errorResponse; | ||
382 | } | ||
383 | } | ||
384 | |||
385 | // check funds | ||
386 | if (client != null) | ||
387 | { | ||
388 | IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); | ||
368 | 389 | ||
369 | if (mm != null) | 390 | if (mm != null) |
370 | { | 391 | { |
371 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) | 392 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) |
372 | { | 393 | { |
373 | if (client != null) | 394 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
374 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
375 | 395 | ||
376 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 396 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
377 | errorResponse.uploader = ""; | 397 | errorResponse.uploader = ""; |