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