diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs (renamed from OpenSim/Region/Environment/PermissionManager.cs) | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index fd8387b..de02702 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -26,12 +26,14 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using Nini.Config; | ||
30 | |||
29 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Scenes; | 32 | using OpenSim.Region.Environment.Scenes; |
31 | 33 | ||
32 | namespace OpenSim.Region.Environment | 34 | namespace OpenSim.Region.Environment.Modules.World.Permissions |
33 | { | 35 | { |
34 | public class PermissionManager | 36 | public class PermissionsModule : IRegionModule, IScenePermissions |
35 | { | 37 | { |
36 | protected Scene m_scene; | 38 | protected Scene m_scene; |
37 | 39 | ||
@@ -43,11 +45,9 @@ namespace OpenSim.Region.Environment | |||
43 | private uint PERM_MOVE = (uint)524288; | 45 | private uint PERM_MOVE = (uint)524288; |
44 | //private uint PERM_TRANS = (uint)8192; | 46 | //private uint PERM_TRANS = (uint)8192; |
45 | private uint PERM_LOCKED = (uint)540672; | 47 | private uint PERM_LOCKED = (uint)540672; |
46 | // Bypasses the permissions engine (always returns OK) | 48 | |
47 | // disable in any production environment | 49 | // Bypasses the permissions engine |
48 | // TODO: Change this to false when permissions are a desired default | 50 | private bool m_bypassPermissions = false; |
49 | // TODO: Move to configuration option. | ||
50 | private bool m_bypassPermissions = true; | ||
51 | 51 | ||
52 | public bool BypassPermissions | 52 | public bool BypassPermissions |
53 | { | 53 | { |
@@ -55,20 +55,40 @@ namespace OpenSim.Region.Environment | |||
55 | set { m_bypassPermissions = value; } | 55 | set { m_bypassPermissions = value; } |
56 | } | 56 | } |
57 | 57 | ||
58 | public PermissionManager() | 58 | #region IRegionModule Members |
59 | |||
60 | public void Initialise(Scene scene, IConfigSource config) | ||
59 | { | 61 | { |
62 | m_scene = scene; | ||
63 | |||
64 | // FIXME: Possibly move all permissions related stuff to its own section | ||
65 | IConfig myConfig = config.Configs["Startup"]; | ||
66 | |||
67 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false); | ||
68 | |||
69 | m_scene.RegisterModuleInterface<IScenePermissions>(this); | ||
60 | } | 70 | } |
61 | 71 | ||
62 | public PermissionManager(Scene scene) | 72 | public void PostInitialise() |
63 | { | 73 | { |
64 | m_scene = scene; | ||
65 | } | 74 | } |
66 | 75 | ||
67 | public void Initialise(Scene scene) | 76 | public void Close() |
68 | { | 77 | { |
69 | m_scene = scene; | ||
70 | } | 78 | } |
71 | 79 | ||
80 | public string Name | ||
81 | { | ||
82 | get { return "PermissionsModule"; } | ||
83 | } | ||
84 | |||
85 | public bool IsSharedModule | ||
86 | { | ||
87 | get { return false; } | ||
88 | } | ||
89 | |||
90 | #endregion | ||
91 | |||
72 | protected virtual void SendPermissionError(LLUUID user, string reason) | 92 | protected virtual void SendPermissionError(LLUUID user, string reason) |
73 | { | 93 | { |
74 | m_scene.EventManager.TriggerPermissionError(user, reason); | 94 | m_scene.EventManager.TriggerPermissionError(user, reason); |
@@ -159,17 +179,9 @@ namespace OpenSim.Region.Environment | |||
159 | return permission; | 179 | return permission; |
160 | } | 180 | } |
161 | 181 | ||
162 | /// <summary> | 182 | /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see> |
163 | /// Permissions check - can user enter an object? | ||
164 | /// </summary> | ||
165 | /// <param name="user">User attempting move an object</param> | ||
166 | /// <param name="oldPos">Source object-position</param> | ||
167 | /// <param name="newPos">Target object-position</param> | ||
168 | /// <returns>Has permission?</returns> | ||
169 | public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos) | 183 | public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos) |
170 | { | 184 | { |
171 | |||
172 | |||
173 | if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f)) | 185 | if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f)) |
174 | { | 186 | { |
175 | return true; | 187 | return true; |
@@ -214,7 +226,6 @@ namespace OpenSim.Region.Environment | |||
214 | 226 | ||
215 | public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID) | 227 | public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID) |
216 | { | 228 | { |
217 | |||
218 | // Here's the way this works, | 229 | // Here's the way this works, |
219 | // ObjectFlags and Permission flags are two different enumerations | 230 | // ObjectFlags and Permission flags are two different enumerations |
220 | // ObjectFlags, however, tells the client to change what it will allow the user to do. | 231 | // ObjectFlags, however, tells the client to change what it will allow the user to do. |
@@ -296,8 +307,6 @@ namespace OpenSim.Region.Environment | |||
296 | return objectEveryoneMask; | 307 | return objectEveryoneMask; |
297 | } | 308 | } |
298 | 309 | ||
299 | |||
300 | |||
301 | private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask) | 310 | private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask) |
302 | { | 311 | { |
303 | // We are adding the temporary objectflags to the object's objectflags based on the | 312 | // We are adding the temporary objectflags to the object's objectflags based on the |
@@ -395,12 +404,7 @@ namespace OpenSim.Region.Environment | |||
395 | return permission; | 404 | return permission; |
396 | } | 405 | } |
397 | 406 | ||
398 | /// <summary> | 407 | /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see> |
399 | /// Permissions check - can user delete an object? | ||
400 | /// </summary> | ||
401 | /// <param name="user">User attempting the delete</param> | ||
402 | /// <param name="obj">Target object</param> | ||
403 | /// <returns>Has permission?</returns> | ||
404 | public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) | 408 | public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) |
405 | { | 409 | { |
406 | return GenericObjectPermission(user, obj); | 410 | return GenericObjectPermission(user, obj); |
@@ -522,7 +526,7 @@ namespace OpenSim.Region.Environment | |||
522 | 526 | ||
523 | #region Communication Permissions | 527 | #region Communication Permissions |
524 | 528 | ||
525 | public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) | 529 | protected virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) |
526 | { | 530 | { |
527 | bool permission = false; | 531 | bool permission = false; |
528 | string reason = "Only registered users may communicate with another account."; | 532 | string reason = "Only registered users may communicate with another account."; |