aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
authorSnoopy Pfeffer2012-03-27 22:09:58 +0200
committerSnoopy Pfeffer2012-03-27 22:09:58 +0200
commit7223b63563f28f6fe8044bdabcd1b9900d28c54a (patch)
tree7bf1df67f9a1388b940b386e64e239f52f986a4b /OpenSim/Region/ClientStack/Linden
parentHG: beginning of a more restrictive inventory access procedure (optional). Ex... (diff)
downloadopensim-SC_OLD-7223b63563f28f6fe8044bdabcd1b9900d28c54a.zip
opensim-SC_OLD-7223b63563f28f6fe8044bdabcd1b9900d28c54a.tar.gz
opensim-SC_OLD-7223b63563f28f6fe8044bdabcd1b9900d28c54a.tar.bz2
opensim-SC_OLD-7223b63563f28f6fe8044bdabcd1b9900d28c54a.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs34
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs44
2 files changed, 58 insertions, 20 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 = "";
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
index 1117f2a..91872c5 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
@@ -56,6 +56,7 @@ namespace OpenSim.Region.ClientStack.Linden
56// private IAssetService m_assetService; 56// private IAssetService m_assetService;
57 private bool m_dumpAssetsToFile = false; 57 private bool m_dumpAssetsToFile = false;
58 private bool m_enabled = true; 58 private bool m_enabled = true;
59 private int m_levelUpload = 0;
59 60
60 #region IRegionModuleBase Members 61 #region IRegionModuleBase Members
61 62
@@ -72,6 +73,7 @@ namespace OpenSim.Region.ClientStack.Linden
72 return; 73 return;
73 74
74 m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); 75 m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true);
76 m_levelUpload = meshConfig.GetInt("LevelUpload", 0);
75 } 77 }
76 78
77 public void AddRegion(Scene pScene) 79 public void AddRegion(Scene pScene)
@@ -137,25 +139,41 @@ namespace OpenSim.Region.ClientStack.Linden
137 // llsdRequest.asset_type == "animation" || 139 // llsdRequest.asset_type == "animation" ||
138 // llsdRequest.asset_type == "sound") 140 // llsdRequest.asset_type == "sound")
139 // { 141 // {
142 // check user level
143 ScenePresence avatar = null;
140 IClientAPI client = null; 144 IClientAPI client = null;
145 m_scene.TryGetScenePresence(agentID, out avatar);
141 146
142 147 if (avatar != null)
148 {
149 client = avatar.ControllingClient;
150
151 if (avatar.UserLevel < m_levelUpload)
152 {
153 if (client != null)
154 client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false);
155
156 LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
157 errorResponse.rsvp = "";
158 errorResponse.state = "error";
159 return errorResponse;
160 }
161 }
162
163 // check funds
143 IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); 164 IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>();
144 165
145 if (mm != null) 166 if (mm != null)
146 { 167 {
147 if (m_scene.TryGetClient(agentID, out client)) 168 if (!mm.UploadCovered(agentID, mm.UploadCharge))
148 { 169 {
149 if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) 170 if (client != null)
150 { 171 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
151 if (client != null) 172
152 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); 173 LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
153 174 errorResponse.rsvp = "";
154 LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); 175 errorResponse.state = "error";
155 errorResponse.rsvp = ""; 176 return errorResponse;
156 errorResponse.state = "error";
157 return errorResponse;
158 }
159 } 177 }
160 } 178 }
161 // } 179 // }