diff options
author | Teravus Ovares | 2008-05-14 23:25:07 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-14 23:25:07 +0000 |
commit | a4efa939932f823af2affe0e97446a8d807004e0 (patch) | |
tree | 58f8b1341aa2a14178bf707841cd368d5394429f /OpenSim/Region/Environment | |
parent | * Refactored IConfigSource into Physics plug-ins and Scene. We can get rid of... (diff) | |
download | opensim-SC-a4efa939932f823af2affe0e97446a8d807004e0.zip opensim-SC-a4efa939932f823af2affe0e97446a8d807004e0.tar.gz opensim-SC-a4efa939932f823af2affe0e97446a8d807004e0.tar.bz2 opensim-SC-a4efa939932f823af2affe0e97446a8d807004e0.tar.xz |
* Comitting 0001271: [PATCH] Refactor permissions to fully allow stacking permissions modules. From Melanie. Thanks Melanie!
Diffstat (limited to 'OpenSim/Region/Environment')
8 files changed, 92 insertions, 42 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs index bef6b44..f28b46c 100644 --- a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs +++ b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs | |||
@@ -31,8 +31,5 @@ namespace OpenSim.Region.Environment.Interfaces | |||
31 | { | 31 | { |
32 | public interface IScenePermissions | 32 | public interface IScenePermissions |
33 | { | 33 | { |
34 | bool BypassPermissions { get; set; } | ||
35 | bool BypassPermissionsValue { get; set; } | ||
36 | uint GenerateClientFlags(LLUUID user, LLUUID objID); | ||
37 | } | 34 | } |
38 | } | 35 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 098175b..fcdec5d 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs | |||
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
205 | 205 | ||
206 | // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml | 206 | // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml |
207 | // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates | 207 | // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates |
208 | if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.Permissions.BypassPermissions) | 208 | if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) |
209 | { | 209 | { |
210 | m_scene.RegionInfo.EstateSettings.AddEstateManager(user); | 210 | m_scene.RegionInfo.EstateSettings.AddEstateManager(user); |
211 | remote_client.sendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID); | 211 | remote_client.sendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID); |
@@ -219,7 +219,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
219 | case 512: | 219 | case 512: |
220 | // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml | 220 | // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml |
221 | // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates | 221 | // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates |
222 | if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.Permissions.BypassPermissions) | 222 | if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) |
223 | { | 223 | { |
224 | m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); | 224 | m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); |
225 | remote_client.sendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID); | 225 | remote_client.sendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID); |
@@ -438,4 +438,4 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
438 | sendRegionHandshake(client); | 438 | sendRegionHandshake(client); |
439 | } | 439 | } |
440 | } | 440 | } |
441 | } \ No newline at end of file | 441 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index bd21ca7..76f21f7 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -63,23 +63,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
63 | private bool m_bypassPermissions = false; | 63 | private bool m_bypassPermissions = false; |
64 | private bool m_bypassPermissionsValue = true; | 64 | private bool m_bypassPermissionsValue = true; |
65 | private bool m_debugPermissions = false; | 65 | private bool m_debugPermissions = false; |
66 | public bool BypassPermissions | ||
67 | { | ||
68 | get { return m_bypassPermissions; } | ||
69 | set { m_bypassPermissions = value; } | ||
70 | } | ||
71 | |||
72 | public bool BypassPermissionsValue | ||
73 | { | ||
74 | get { return m_bypassPermissionsValue; } | ||
75 | set { m_bypassPermissionsValue = value; } | ||
76 | } | ||
77 | 66 | ||
78 | public bool DebugPermissions | ||
79 | { | ||
80 | get { return m_debugPermissions; } | ||
81 | set { m_debugPermissions = value; } | ||
82 | } | ||
83 | #endregion | 67 | #endregion |
84 | 68 | ||
85 | #region ICommandableModule Members | 69 | #region ICommandableModule Members |
@@ -157,7 +141,10 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
157 | m_scene.RegisterModuleInterface<IScenePermissions>(this); | 141 | m_scene.RegisterModuleInterface<IScenePermissions>(this); |
158 | 142 | ||
159 | //Register functions with Scene External Checks! | 143 | //Register functions with Scene External Checks! |
144 | m_scene.ExternalChecks.addBypassPermissions(BypassPermissions); //FULLY IMPLEMENTED | ||
145 | m_scene.ExternalChecks.addSetBypassPermissions(SetBypassPermissions); //FULLY IMPLEMENTED | ||
160 | m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED | 146 | m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED |
147 | m_scene.ExternalChecks.addGenerateClientFlags(GenerateClientFlags); //NOT YET FULLY IMPLEMENTED | ||
161 | m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED | 148 | m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED |
162 | m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED | 149 | m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED |
163 | m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED | 150 | m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED |
@@ -260,6 +247,16 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
260 | } | 247 | } |
261 | #endregion | 248 | #endregion |
262 | 249 | ||
250 | public bool BypassPermissions() | ||
251 | { | ||
252 | return m_bypassPermissions; | ||
253 | } | ||
254 | |||
255 | public void SetBypassPermissions(bool value) | ||
256 | { | ||
257 | m_bypassPermissions=value; | ||
258 | } | ||
259 | |||
263 | #region Object Permissions | 260 | #region Object Permissions |
264 | 261 | ||
265 | public uint GenerateClientFlags(LLUUID user, LLUUID objID) | 262 | public uint GenerateClientFlags(LLUUID user, LLUUID objID) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 5b93ef9..51f2942 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -115,7 +115,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
115 | protected IXMLRPC m_xmlrpcModule; | 115 | protected IXMLRPC m_xmlrpcModule; |
116 | protected IWorldComm m_worldCommModule; | 116 | protected IWorldComm m_worldCommModule; |
117 | protected IAvatarFactory m_AvatarFactory; | 117 | protected IAvatarFactory m_AvatarFactory; |
118 | protected IScenePermissions m_permissions; | ||
119 | protected IConfigSource m_config; | 118 | protected IConfigSource m_config; |
120 | 119 | ||
121 | // Central Update Loop | 120 | // Central Update Loop |
@@ -173,14 +172,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
173 | get { return m_timedilation; } | 172 | get { return m_timedilation; } |
174 | } | 173 | } |
175 | 174 | ||
176 | /// <summary> | ||
177 | /// The reference by which general permissions in the scene can be set and queried. | ||
178 | /// </summary> | ||
179 | public IScenePermissions Permissions | ||
180 | { | ||
181 | get { return m_permissions; } | ||
182 | } | ||
183 | |||
184 | public int TimePhase | 175 | public int TimePhase |
185 | { | 176 | { |
186 | get { return m_timePhase; } | 177 | get { return m_timePhase; } |
@@ -660,7 +651,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
660 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); | 651 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); |
661 | XferManager = RequestModuleInterface<IXfer>(); | 652 | XferManager = RequestModuleInterface<IXfer>(); |
662 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); | 653 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); |
663 | m_permissions = RequestModuleInterface<IScenePermissions>(); | ||
664 | } | 654 | } |
665 | 655 | ||
666 | #endregion | 656 | #endregion |
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index aa4e043..53c8fc3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |||
@@ -45,6 +45,78 @@ namespace OpenSim.Region.Environment.Scenes | |||
45 | 45 | ||
46 | #region Object Permission Checks | 46 | #region Object Permission Checks |
47 | 47 | ||
48 | public delegate uint GenerateClientFlags(LLUUID userID, LLUUID objectIDID); | ||
49 | private List<GenerateClientFlags> GenerateClientFlagsCheckFunctions = new List<GenerateClientFlags>(); | ||
50 | |||
51 | public void addGenerateClientFlags(GenerateClientFlags delegateFunc) | ||
52 | { | ||
53 | if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) | ||
54 | GenerateClientFlagsCheckFunctions.Add(delegateFunc); | ||
55 | } | ||
56 | public void removeGenerateClientFlags(GenerateClientFlags delegateFunc) | ||
57 | { | ||
58 | if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) | ||
59 | GenerateClientFlagsCheckFunctions.Remove(delegateFunc); | ||
60 | } | ||
61 | |||
62 | public uint ExternalChecksGenerateClientFlags(LLUUID userID, LLUUID objectID) | ||
63 | { | ||
64 | uint perms=(uint)2147483647; | ||
65 | foreach (GenerateClientFlags check in GenerateClientFlagsCheckFunctions) | ||
66 | { | ||
67 | perms &= check(userID, objectID); | ||
68 | } | ||
69 | return perms; | ||
70 | } | ||
71 | |||
72 | public delegate void SetBypassPermissions(bool value); | ||
73 | private List<SetBypassPermissions> SetBypassPermissionsCheckFunctions = new List<SetBypassPermissions>(); | ||
74 | |||
75 | public void addSetBypassPermissions(SetBypassPermissions delegateFunc) | ||
76 | { | ||
77 | if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc)) | ||
78 | SetBypassPermissionsCheckFunctions.Add(delegateFunc); | ||
79 | } | ||
80 | public void removeSetBypassPermissions(SetBypassPermissions delegateFunc) | ||
81 | { | ||
82 | if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc)) | ||
83 | SetBypassPermissionsCheckFunctions.Remove(delegateFunc); | ||
84 | } | ||
85 | |||
86 | public void ExternalChecksSetBypassPermissions(bool value) | ||
87 | { | ||
88 | foreach (SetBypassPermissions check in SetBypassPermissionsCheckFunctions) | ||
89 | { | ||
90 | check(value); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public delegate bool BypassPermissions(); | ||
95 | private List<BypassPermissions> BypassPermissionsCheckFunctions = new List<BypassPermissions>(); | ||
96 | |||
97 | public void addBypassPermissions(BypassPermissions delegateFunc) | ||
98 | { | ||
99 | if (!BypassPermissionsCheckFunctions.Contains(delegateFunc)) | ||
100 | BypassPermissionsCheckFunctions.Add(delegateFunc); | ||
101 | } | ||
102 | public void removeBypassPermissions(BypassPermissions delegateFunc) | ||
103 | { | ||
104 | if (BypassPermissionsCheckFunctions.Contains(delegateFunc)) | ||
105 | BypassPermissionsCheckFunctions.Remove(delegateFunc); | ||
106 | } | ||
107 | |||
108 | public bool ExternalChecksBypassPermissions() | ||
109 | { | ||
110 | foreach (BypassPermissions check in BypassPermissionsCheckFunctions) | ||
111 | { | ||
112 | if (check() == false) | ||
113 | { | ||
114 | return false; | ||
115 | } | ||
116 | } | ||
117 | return true; | ||
118 | } | ||
119 | |||
48 | #region REZ OBJECT | 120 | #region REZ OBJECT |
49 | public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene); | 121 | public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene); |
50 | private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>(); | 122 | private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>(); |
@@ -654,4 +726,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
654 | 726 | ||
655 | } | 727 | } |
656 | } | 728 | } |
657 | \ No newline at end of file | 729 | |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 1f1f39f..215ab75 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
191 | 191 | ||
192 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) | 192 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) |
193 | { | 193 | { |
194 | ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.BypassPermissions = bypassPermissions; }); | 194 | ForEachCurrentScene(delegate(Scene scene) { scene.ExternalChecks.ExternalChecksSetBypassPermissions(bypassPermissions); }); |
195 | } | 195 | } |
196 | 196 | ||
197 | private void ForEachCurrentScene(Action<Scene> func) | 197 | private void ForEachCurrentScene(Action<Scene> func) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 4a112ae..3ec6ed8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1351,7 +1351,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1351 | if (part.OwnerID != cAgentID) | 1351 | if (part.OwnerID != cAgentID) |
1352 | { | 1352 | { |
1353 | // Apply Next Owner Permissions if we're not bypassing permissions | 1353 | // Apply Next Owner Permissions if we're not bypassing permissions |
1354 | if (!m_scene.Permissions.BypassPermissions) | 1354 | if (!m_scene.ExternalChecks.ExternalChecksBypassPermissions()) |
1355 | m_rootPart.ApplyNextOwnerPermissions(); | 1355 | m_rootPart.ApplyNextOwnerPermissions(); |
1356 | } | 1356 | } |
1357 | 1357 | ||
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 4ef0d27..8ac1a77 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -476,13 +476,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
476 | 476 | ||
477 | public uint GenerateClientFlags(LLUUID ObjectID) | 477 | public uint GenerateClientFlags(LLUUID ObjectID) |
478 | { | 478 | { |
479 | if(m_scene.Permissions == null) | 479 | return m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(m_uuid, ObjectID); |
480 | { | ||
481 | SceneObjectPart task=m_scene.GetSceneObjectPart(ObjectID); | ||
482 | |||
483 | return task.GetEffectiveObjectFlags() | (uint)2147483647; | ||
484 | } | ||
485 | return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID); | ||
486 | } | 480 | } |
487 | 481 | ||
488 | /// <summary> | 482 | /// <summary> |