diff options
author | Melanie | 2010-11-23 14:03:52 +0000 |
---|---|---|
committer | Melanie | 2010-11-23 14:03:52 +0000 |
commit | 2527aeb40c5752016524e10797a6d09b4e6816af (patch) | |
tree | e425b306aa311c639115904df9a68241078b1689 /OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |
parent | Fix more potential nullrefs (diff) | |
parent | Initialize InventoryItemBase.creatorData properly. Could throw. (diff) | |
download | opensim-SC_OLD-2527aeb40c5752016524e10797a6d09b4e6816af.zip opensim-SC_OLD-2527aeb40c5752016524e10797a6d09b4e6816af.tar.gz opensim-SC_OLD-2527aeb40c5752016524e10797a6d09b4e6816af.tar.bz2 opensim-SC_OLD-2527aeb40c5752016524e10797a6d09b4e6816af.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Permissions.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 06890a0..d67638a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -27,13 +27,15 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
30 | using System.Text; | 31 | using System.Text; |
32 | using log4net; | ||
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
33 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
34 | 36 | ||
35 | namespace OpenSim.Region.Framework.Scenes | 37 | namespace OpenSim.Region.Framework.Scenes |
36 | { | 38 | { |
37 | #region Delegates | 39 | #region Delegates |
38 | public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID); | 40 | public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID); |
39 | public delegate void SetBypassPermissionsHandler(bool value); | 41 | public delegate void SetBypassPermissionsHandler(bool value); |
@@ -88,6 +90,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
88 | 90 | ||
89 | public class ScenePermissions | 91 | public class ScenePermissions |
90 | { | 92 | { |
93 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
94 | |||
91 | private Scene m_scene; | 95 | private Scene m_scene; |
92 | 96 | ||
93 | public ScenePermissions(Scene scene) | 97 | public ScenePermissions(Scene scene) |
@@ -242,6 +246,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
242 | #region DELETE OBJECT | 246 | #region DELETE OBJECT |
243 | public bool CanDeleteObject(UUID objectID, UUID deleter) | 247 | public bool CanDeleteObject(UUID objectID, UUID deleter) |
244 | { | 248 | { |
249 | bool result = true; | ||
250 | |||
245 | DeleteObjectHandler handler = OnDeleteObject; | 251 | DeleteObjectHandler handler = OnDeleteObject; |
246 | if (handler != null) | 252 | if (handler != null) |
247 | { | 253 | { |
@@ -249,10 +255,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
249 | foreach (DeleteObjectHandler h in list) | 255 | foreach (DeleteObjectHandler h in list) |
250 | { | 256 | { |
251 | if (h(objectID, deleter, m_scene) == false) | 257 | if (h(objectID, deleter, m_scene) == false) |
252 | return false; | 258 | { |
259 | result = false; | ||
260 | break; | ||
261 | } | ||
253 | } | 262 | } |
254 | } | 263 | } |
255 | return true; | 264 | |
265 | // m_log.DebugFormat( | ||
266 | // "[SCENE PERMISSIONS]: CanDeleteObject() fired for object {0}, deleter {1}, result {2}", | ||
267 | // objectID, deleter, result); | ||
268 | |||
269 | return result; | ||
256 | } | 270 | } |
257 | 271 | ||
258 | #endregion | 272 | #endregion |
@@ -260,6 +274,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
260 | #region TAKE OBJECT | 274 | #region TAKE OBJECT |
261 | public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) | 275 | public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) |
262 | { | 276 | { |
277 | bool result = true; | ||
278 | |||
263 | TakeObjectHandler handler = OnTakeObject; | 279 | TakeObjectHandler handler = OnTakeObject; |
264 | if (handler != null) | 280 | if (handler != null) |
265 | { | 281 | { |
@@ -267,10 +283,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
267 | foreach (TakeObjectHandler h in list) | 283 | foreach (TakeObjectHandler h in list) |
268 | { | 284 | { |
269 | if (h(objectID, AvatarTakingUUID, m_scene) == false) | 285 | if (h(objectID, AvatarTakingUUID, m_scene) == false) |
270 | return false; | 286 | { |
287 | result = false; | ||
288 | break; | ||
289 | } | ||
271 | } | 290 | } |
272 | } | 291 | } |
273 | return true; | 292 | |
293 | // m_log.DebugFormat( | ||
294 | // "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}", | ||
295 | // objectID, AvatarTakingUUID, result); | ||
296 | |||
297 | return result; | ||
274 | } | 298 | } |
275 | 299 | ||
276 | #endregion | 300 | #endregion |
@@ -278,6 +302,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
278 | #region TAKE COPY OBJECT | 302 | #region TAKE COPY OBJECT |
279 | public bool CanTakeCopyObject(UUID objectID, UUID userID) | 303 | public bool CanTakeCopyObject(UUID objectID, UUID userID) |
280 | { | 304 | { |
305 | bool result = true; | ||
306 | |||
281 | TakeCopyObjectHandler handler = OnTakeCopyObject; | 307 | TakeCopyObjectHandler handler = OnTakeCopyObject; |
282 | if (handler != null) | 308 | if (handler != null) |
283 | { | 309 | { |
@@ -285,10 +311,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
285 | foreach (TakeCopyObjectHandler h in list) | 311 | foreach (TakeCopyObjectHandler h in list) |
286 | { | 312 | { |
287 | if (h(objectID, userID, m_scene) == false) | 313 | if (h(objectID, userID, m_scene) == false) |
288 | return false; | 314 | { |
315 | result = false; | ||
316 | break; | ||
317 | } | ||
289 | } | 318 | } |
290 | } | 319 | } |
291 | return true; | 320 | |
321 | // m_log.DebugFormat( | ||
322 | // "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}", | ||
323 | // objectID, userID, result); | ||
324 | |||
325 | return result; | ||
292 | } | 326 | } |
293 | 327 | ||
294 | #endregion | 328 | #endregion |
@@ -383,6 +417,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
383 | #region RETURN OBJECT | 417 | #region RETURN OBJECT |
384 | public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) | 418 | public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) |
385 | { | 419 | { |
420 | bool result = true; | ||
421 | |||
386 | ReturnObjectsHandler handler = OnReturnObjects; | 422 | ReturnObjectsHandler handler = OnReturnObjects; |
387 | if (handler != null) | 423 | if (handler != null) |
388 | { | 424 | { |
@@ -390,10 +426,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
390 | foreach (ReturnObjectsHandler h in list) | 426 | foreach (ReturnObjectsHandler h in list) |
391 | { | 427 | { |
392 | if (h(land, user, objects, m_scene) == false) | 428 | if (h(land, user, objects, m_scene) == false) |
393 | return false; | 429 | { |
430 | result = false; | ||
431 | break; | ||
432 | } | ||
394 | } | 433 | } |
395 | } | 434 | } |
396 | return true; | 435 | |
436 | // m_log.DebugFormat( | ||
437 | // "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}", | ||
438 | // user, objects.Count, land.LandData.Name, result); | ||
439 | |||
440 | return result; | ||
397 | } | 441 | } |
398 | 442 | ||
399 | #endregion | 443 | #endregion |