diff options
author | Revolution | 2010-01-22 18:09:33 -0600 |
---|---|---|
committer | Melanie | 2010-01-23 15:18:52 +0000 |
commit | ec3c31e61e5e540f822891110df9bc978655bbaf (patch) | |
tree | b0b34a239eab48e163a3ca064edcd7567948423c /OpenSim/Region/CoreModules/World/Permissions | |
parent | add a target position to agent updates to ScenePresence to support alternativ... (diff) | |
download | opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.zip opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.gz opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.bz2 opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.xz |
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Permissions')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 212 |
1 files changed, 136 insertions, 76 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f66f01f..68e8485 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -89,7 +90,8 @@ enum GroupPowers : long | |||
89 | 90 | ||
90 | namespace OpenSim.Region.CoreModules.World.Permissions | 91 | namespace OpenSim.Region.CoreModules.World.Permissions |
91 | { | 92 | { |
92 | public class PermissionsModule : IRegionModule | 93 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
94 | public class PermissionsModule : INonSharedRegionModule | ||
93 | { | 95 | { |
94 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 96 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
95 | 97 | ||
@@ -148,12 +150,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
148 | 150 | ||
149 | #endregion | 151 | #endregion |
150 | 152 | ||
151 | #region IRegionModule Members | 153 | #region INonSharedRegionModule Members |
152 | 154 | ||
153 | public void Initialise(Scene scene, IConfigSource config) | 155 | public void Initialise(IConfigSource config) |
154 | { | 156 | { |
155 | m_scene = scene; | ||
156 | |||
157 | IConfig myConfig = config.Configs["Startup"]; | 157 | IConfig myConfig = config.Configs["Startup"]; |
158 | 158 | ||
159 | string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); | 159 | string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); |
@@ -177,7 +177,57 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
177 | if (m_bypassPermissions) | 177 | if (m_bypassPermissions) |
178 | m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks"); | 178 | m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks"); |
179 | else | 179 | else |
180 | m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); | 180 | m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); |
181 | |||
182 | string grant = myConfig.GetString("GrantLSL",""); | ||
183 | if (grant.Length > 0) { | ||
184 | foreach (string uuidl in grant.Split(',')) { | ||
185 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
186 | GrantLSL.Add(uuid, true); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | grant = myConfig.GetString("GrantCS",""); | ||
191 | if (grant.Length > 0) { | ||
192 | foreach (string uuidl in grant.Split(',')) { | ||
193 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
194 | GrantCS.Add(uuid, true); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | grant = myConfig.GetString("GrantVB",""); | ||
199 | if (grant.Length > 0) { | ||
200 | foreach (string uuidl in grant.Split(',')) { | ||
201 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
202 | GrantVB.Add(uuid, true); | ||
203 | } | ||
204 | } | ||
205 | |||
206 | grant = myConfig.GetString("GrantJS", ""); | ||
207 | if (grant.Length > 0) | ||
208 | { | ||
209 | foreach (string uuidl in grant.Split(',')) | ||
210 | { | ||
211 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
212 | GrantJS.Add(uuid, true); | ||
213 | } | ||
214 | } | ||
215 | |||
216 | grant = myConfig.GetString("GrantYP", ""); | ||
217 | if (grant.Length > 0) | ||
218 | { | ||
219 | foreach (string uuidl in grant.Split(',')) | ||
220 | { | ||
221 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
222 | GrantYP.Add(uuid, true); | ||
223 | } | ||
224 | } | ||
225 | |||
226 | } | ||
227 | |||
228 | public void AddRegion(Scene scene) | ||
229 | { | ||
230 | m_scene = scene; | ||
181 | 231 | ||
182 | //Register functions with Scene External Checks! | 232 | //Register functions with Scene External Checks! |
183 | m_scene.Permissions.OnBypassPermissions += BypassPermissions; | 233 | m_scene.Permissions.OnBypassPermissions += BypassPermissions; |
@@ -210,23 +260,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
210 | m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED | 260 | m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED |
211 | m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED | 261 | m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED |
212 | m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED | 262 | m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED |
213 | 263 | ||
214 | m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED | 264 | m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED |
215 | m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED | 265 | m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED |
216 | m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED | 266 | m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED |
217 | m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED | 267 | m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED |
218 | 268 | ||
219 | m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE | 269 | m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE |
220 | m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED | 270 | m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED |
221 | m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED | 271 | m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED |
222 | m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED | 272 | m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED |
223 | m_scene.Permissions.OnResetScript += CanResetScript; | 273 | m_scene.Permissions.OnResetScript += CanResetScript; |
224 | 274 | ||
225 | m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED | 275 | m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED |
226 | m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED | 276 | m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED |
227 | m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED | 277 | m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED |
228 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED | 278 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED |
229 | 279 | ||
230 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED | 280 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED |
231 | m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED | 281 | m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED |
232 | 282 | ||
@@ -244,52 +294,87 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
244 | "debug permissions <true / false>", | 294 | "debug permissions <true / false>", |
245 | "Enable permissions debugging", | 295 | "Enable permissions debugging", |
246 | HandleDebugPermissions); | 296 | HandleDebugPermissions); |
247 | 297 | } | |
248 | |||
249 | string grant = myConfig.GetString("GrantLSL",""); | ||
250 | if (grant.Length > 0) { | ||
251 | foreach (string uuidl in grant.Split(',')) { | ||
252 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
253 | GrantLSL.Add(uuid, true); | ||
254 | } | ||
255 | } | ||
256 | 298 | ||
257 | grant = myConfig.GetString("GrantCS",""); | 299 | public Type ReplaceableInterface |
258 | if (grant.Length > 0) { | 300 | { |
259 | foreach (string uuidl in grant.Split(',')) { | 301 | get { return null; } |
260 | string uuid = uuidl.Trim(" \t".ToCharArray()); | 302 | } |
261 | GrantCS.Add(uuid, true); | ||
262 | } | ||
263 | } | ||
264 | 303 | ||
265 | grant = myConfig.GetString("GrantVB",""); | 304 | public void RegionLoaded(Scene scene) |
266 | if (grant.Length > 0) { | 305 | { |
267 | foreach (string uuidl in grant.Split(',')) { | 306 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
268 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
269 | GrantVB.Add(uuid, true); | ||
270 | } | ||
271 | } | ||
272 | 307 | ||
273 | grant = myConfig.GetString("GrantJS", ""); | 308 | if (m_friendsModule == null) |
274 | if (grant.Length > 0) | 309 | m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); |
275 | { | 310 | else |
276 | foreach (string uuidl in grant.Split(',')) | 311 | m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); |
277 | { | 312 | } |
278 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
279 | GrantJS.Add(uuid, true); | ||
280 | } | ||
281 | } | ||
282 | 313 | ||
283 | grant = myConfig.GetString("GrantYP", ""); | 314 | public void RemoveRegion(Scene scene) |
284 | if (grant.Length > 0) | 315 | { |
285 | { | 316 | scene.Permissions.OnBypassPermissions -= BypassPermissions; |
286 | foreach (string uuidl in grant.Split(',')) | 317 | scene.Permissions.OnSetBypassPermissions -= SetBypassPermissions; |
287 | { | 318 | scene.Permissions.OnPropagatePermissions -= PropagatePermissions; |
288 | string uuid = uuidl.Trim(" \t".ToCharArray()); | 319 | scene.Permissions.OnGenerateClientFlags -= GenerateClientFlags; |
289 | GrantYP.Add(uuid, true); | 320 | scene.Permissions.OnAbandonParcel -= CanAbandonParcel; |
290 | } | 321 | scene.Permissions.OnReclaimParcel -= CanReclaimParcel; |
291 | } | 322 | scene.Permissions.OnDeedParcel -= CanDeedParcel; |
323 | scene.Permissions.OnDeedObject -= CanDeedObject; | ||
324 | scene.Permissions.OnIsGod -= IsGod; | ||
325 | scene.Permissions.OnDuplicateObject -= CanDuplicateObject; | ||
326 | scene.Permissions.OnDeleteObject -= CanDeleteObject; //MAYBE FULLY IMPLEMENTED | ||
327 | scene.Permissions.OnEditObject -= CanEditObject; //MAYBE FULLY IMPLEMENTED | ||
328 | scene.Permissions.OnEditParcel -= CanEditParcel; //MAYBE FULLY IMPLEMENTED | ||
329 | scene.Permissions.OnInstantMessage -= CanInstantMessage; | ||
330 | scene.Permissions.OnInventoryTransfer -= CanInventoryTransfer; //NOT YET IMPLEMENTED | ||
331 | scene.Permissions.OnIssueEstateCommand -= CanIssueEstateCommand; //FULLY IMPLEMENTED | ||
332 | scene.Permissions.OnMoveObject -= CanMoveObject; //MAYBE FULLY IMPLEMENTED | ||
333 | scene.Permissions.OnObjectEntry -= CanObjectEntry; | ||
334 | scene.Permissions.OnReturnObject -= CanReturnObject; //NOT YET IMPLEMENTED | ||
335 | scene.Permissions.OnRezObject -= CanRezObject; //MAYBE FULLY IMPLEMENTED | ||
336 | scene.Permissions.OnRunConsoleCommand -= CanRunConsoleCommand; | ||
337 | scene.Permissions.OnRunScript -= CanRunScript; //NOT YET IMPLEMENTED | ||
338 | scene.Permissions.OnCompileScript -= CanCompileScript; | ||
339 | scene.Permissions.OnSellParcel -= CanSellParcel; | ||
340 | scene.Permissions.OnTakeObject -= CanTakeObject; | ||
341 | scene.Permissions.OnTakeCopyObject -= CanTakeCopyObject; | ||
342 | scene.Permissions.OnTerraformLand -= CanTerraformLand; | ||
343 | scene.Permissions.OnLinkObject -= CanLinkObject; //NOT YET IMPLEMENTED | ||
344 | scene.Permissions.OnDelinkObject -= CanDelinkObject; //NOT YET IMPLEMENTED | ||
345 | scene.Permissions.OnBuyLand -= CanBuyLand; //NOT YET IMPLEMENTED | ||
346 | |||
347 | scene.Permissions.OnViewNotecard -= CanViewNotecard; //NOT YET IMPLEMENTED | ||
348 | scene.Permissions.OnViewScript -= CanViewScript; //NOT YET IMPLEMENTED | ||
349 | scene.Permissions.OnEditNotecard -= CanEditNotecard; //NOT YET IMPLEMENTED | ||
350 | scene.Permissions.OnEditScript -= CanEditScript; //NOT YET IMPLEMENTED | ||
351 | |||
352 | scene.Permissions.OnCreateObjectInventory -= CanCreateObjectInventory; //NOT IMPLEMENTED HERE | ||
353 | scene.Permissions.OnEditObjectInventory -= CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED | ||
354 | scene.Permissions.OnCopyObjectInventory -= CanCopyObjectInventory; //NOT YET IMPLEMENTED | ||
355 | scene.Permissions.OnDeleteObjectInventory -= CanDeleteObjectInventory; //NOT YET IMPLEMENTED | ||
356 | scene.Permissions.OnResetScript -= CanResetScript; | ||
357 | |||
358 | scene.Permissions.OnCreateUserInventory -= CanCreateUserInventory; //NOT YET IMPLEMENTED | ||
359 | scene.Permissions.OnCopyUserInventory -= CanCopyUserInventory; //NOT YET IMPLEMENTED | ||
360 | scene.Permissions.OnEditUserInventory -= CanEditUserInventory; //NOT YET IMPLEMENTED | ||
361 | scene.Permissions.OnDeleteUserInventory -= CanDeleteUserInventory; //NOT YET IMPLEMENTED | ||
362 | |||
363 | scene.Permissions.OnTeleport -= CanTeleport; //NOT YET IMPLEMENTED | ||
364 | scene.Permissions.OnUseObjectReturn -= CanUseObjectReturn; //NOT YET IMPLEMENTED | ||
365 | } | ||
366 | |||
367 | public void PostInitialise() | ||
368 | { | ||
369 | } | ||
370 | |||
371 | public void Close() | ||
372 | { | ||
373 | } | ||
292 | 374 | ||
375 | public string Name | ||
376 | { | ||
377 | get { return "PermissionsModule"; } | ||
293 | } | 378 | } |
294 | 379 | ||
295 | public void HandleBypassPermissions(string module, string[] args) | 380 | public void HandleBypassPermissions(string module, string[] args) |
@@ -362,31 +447,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
362 | m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName); | 447 | m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName); |
363 | } | 448 | } |
364 | } | 449 | } |
365 | |||
366 | public void PostInitialise() | ||
367 | { | ||
368 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
369 | |||
370 | if (m_friendsModule == null) | ||
371 | m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); | ||
372 | else | ||
373 | m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); | ||
374 | } | ||
375 | |||
376 | public void Close() | ||
377 | { | ||
378 | } | ||
379 | |||
380 | public string Name | ||
381 | { | ||
382 | get { return "PermissionsModule"; } | ||
383 | } | ||
384 | |||
385 | public bool IsSharedModule | ||
386 | { | ||
387 | get { return false; } | ||
388 | } | ||
389 | |||
390 | #endregion | 450 | #endregion |
391 | 451 | ||
392 | #region Helper Functions | 452 | #region Helper Functions |