diff options
author | UbitUmarov | 2017-01-05 18:02:59 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-05 18:02:59 +0000 |
commit | cbc3501246d5250788634f6d1b6fbd1f60661c85 (patch) | |
tree | 5983ff6f4c0ce5bce469c6b1257b9b60069cf79f /OpenSim/Region/CoreModules/Avatar | |
parent | a few changes to estates port handling (diff) | |
download | opensim-SC_OLD-cbc3501246d5250788634f6d1b6fbd1f60661c85.zip opensim-SC_OLD-cbc3501246d5250788634f6d1b6fbd1f60661c85.tar.gz opensim-SC_OLD-cbc3501246d5250788634f6d1b6fbd1f60661c85.tar.bz2 opensim-SC_OLD-cbc3501246d5250788634f6d1b6fbd1f60661c85.tar.xz |
a few changes to Gods ( ie administrators) control
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | 125 |
1 files changed, 56 insertions, 69 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index e0c4924..db02379 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | |||
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
152 | if (god == null || god.ControllingClient.SessionId != godSessionID) | 152 | if (god == null || god.ControllingClient.SessionId != godSessionID) |
153 | return String.Empty; | 153 | return String.Empty; |
154 | 154 | ||
155 | KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason)); | 155 | KickUser(godID, agentID, kickFlags, Util.StringToBytes1024(reason)); |
156 | } | 156 | } |
157 | else | 157 | else |
158 | { | 158 | { |
@@ -162,59 +162,53 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
162 | } | 162 | } |
163 | 163 | ||
164 | public void RequestGodlikePowers( | 164 | public void RequestGodlikePowers( |
165 | UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) | 165 | UUID agentID, UUID sessionID, UUID token, bool godLike) |
166 | { | 166 | { |
167 | ScenePresence sp = m_scene.GetScenePresence(agentID); | 167 | ScenePresence sp = m_scene.GetScenePresence(agentID); |
168 | if(sp == null || sp.IsDeleted || sp.isNPC) | ||
169 | return; | ||
168 | 170 | ||
169 | if (sp != null) | 171 | if (sessionID != sp.ControllingClient.SessionId) |
170 | { | 172 | return; |
171 | if (godLike == false) | ||
172 | { | ||
173 | sp.GrantGodlikePowers(agentID, sessionID, token, godLike); | ||
174 | return; | ||
175 | } | ||
176 | 173 | ||
177 | // First check that this is the sim owner | 174 | sp.GrantGodlikePowers(token, godLike); |
178 | if (m_scene.Permissions.IsGod(agentID)) | 175 | |
179 | { | 176 | if (godLike && sp.GodLevel < 200 && DialogModule != null) |
180 | // Next we check for spoofing..... | 177 | DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); |
181 | UUID testSessionID = sp.ControllingClient.SessionId; | ||
182 | if (sessionID == testSessionID) | ||
183 | { | ||
184 | if (sessionID == controllingClient.SessionId) | ||
185 | { | ||
186 | //m_log.Info("godlike: " + godLike.ToString()); | ||
187 | sp.GrantGodlikePowers(agentID, testSessionID, token, godLike); | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | else | ||
192 | { | ||
193 | if (DialogModule != null) | ||
194 | DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); | ||
195 | } | ||
196 | } | ||
197 | } | 178 | } |
198 | 179 | ||
199 | /// <summary> | 180 | /// <summary> |
200 | /// Kicks User specified from the simulator. This logs them off of the grid | 181 | /// Kicks or freezes User specified from the simulator. This logs them off of the grid |
201 | /// If the client gets the UUID: 44e87126e7944ded05b37c42da3d5cdb it assumes | ||
202 | /// that you're kicking it even if the avatar's UUID isn't the UUID that the | ||
203 | /// agent is assigned | ||
204 | /// </summary> | 182 | /// </summary> |
205 | /// <param name="godID">The person doing the kicking</param> | 183 | /// <param name="godID">The person doing the kicking</param> |
206 | /// <param name="sessionID">The session of the person doing the kicking</param> | ||
207 | /// <param name="agentID">the person that is being kicked</param> | 184 | /// <param name="agentID">the person that is being kicked</param> |
208 | /// <param name="kickflags">Tells what to do to the user</param> | 185 | /// <param name="kickflags">Tells what to do to the user</param> |
209 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> | 186 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> |
210 | public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) | 187 | public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason) |
211 | { | 188 | { |
212 | if (!m_scene.Permissions.IsGod(godID)) | 189 | // assuming automatic god rights on this for fast griefing reaction |
190 | // this is also needed for kick via message | ||
191 | if(!m_scene.Permissions.IsGod(godID)) | ||
213 | return; | 192 | return; |
214 | 193 | ||
215 | ScenePresence sp = m_scene.GetScenePresence(agentID); | 194 | int godlevel = 200; |
195 | // update level so higher gods can kick lower ones | ||
196 | ScenePresence god = m_scene.GetScenePresence(godID); | ||
197 | if(god != null && god.GodLevel > godlevel) | ||
198 | godlevel = god.GodLevel; | ||
216 | 199 | ||
217 | if (sp == null && agentID != ALL_AGENTS) | 200 | if(agentID == ALL_AGENTS) |
201 | { | ||
202 | m_scene.ForEachRootScenePresence(delegate(ScenePresence p) | ||
203 | { | ||
204 | if (p.UUID != godID && godlevel > p.GodLevel) | ||
205 | doKickmodes(godID, p, kickflags, reason); | ||
206 | }); | ||
207 | return; | ||
208 | } | ||
209 | |||
210 | ScenePresence sp = m_scene.GetScenePresence(agentID); | ||
211 | if (sp == null || sp.IsChildAgent) | ||
218 | { | 212 | { |
219 | IMessageTransferModule transferModule = | 213 | IMessageTransferModule transferModule = |
220 | m_scene.RequestModuleInterface<IMessageTransferModule>(); | 214 | m_scene.RequestModuleInterface<IMessageTransferModule>(); |
@@ -230,48 +224,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
230 | return; | 224 | return; |
231 | } | 225 | } |
232 | 226 | ||
227 | if (godlevel <= sp.GodLevel) // no god wars | ||
228 | return; | ||
229 | |||
230 | if(sp.UUID == godID) | ||
231 | return; | ||
232 | |||
233 | doKickmodes(godID, sp, kickflags, reason); | ||
234 | } | ||
235 | |||
236 | private void doKickmodes(UUID godID, ScenePresence sp, uint kickflags, byte[] reason) | ||
237 | { | ||
233 | switch (kickflags) | 238 | switch (kickflags) |
234 | { | 239 | { |
235 | case 0: | 240 | case 0: |
236 | if (sp != null) | ||
237 | { | ||
238 | KickPresence(sp, Utils.BytesToString(reason)); | 241 | KickPresence(sp, Utils.BytesToString(reason)); |
239 | } | 242 | break; |
240 | else if (agentID == ALL_AGENTS) | 243 | case 1: |
241 | { | ||
242 | m_scene.ForEachRootScenePresence( | ||
243 | delegate(ScenePresence p) | ||
244 | { | ||
245 | if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID))) | ||
246 | KickPresence(p, Utils.BytesToString(reason)); | ||
247 | } | ||
248 | ); | ||
249 | } | ||
250 | break; | ||
251 | case 1: | ||
252 | if (sp != null) | ||
253 | { | ||
254 | sp.AllowMovement = false; | 244 | sp.AllowMovement = false; |
255 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | 245 | m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason)); |
256 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); | 246 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); |
257 | } | 247 | break; |
258 | break; | 248 | case 2: |
259 | case 2: | ||
260 | if (sp != null) | ||
261 | { | ||
262 | sp.AllowMovement = true; | 249 | sp.AllowMovement = true; |
263 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | 250 | m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason)); |
264 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); | 251 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); |
265 | } | 252 | break; |
266 | break; | 253 | default: |
267 | default: | 254 | break; |
268 | break; | ||
269 | } | 255 | } |
270 | } | 256 | } |
271 | 257 | ||
258 | |||
272 | private void KickPresence(ScenePresence sp, string reason) | 259 | private void KickPresence(ScenePresence sp, string reason) |
273 | { | 260 | { |
274 | if (sp.IsChildAgent) | 261 | if(sp.IsDeleted || sp.IsChildAgent) |
275 | return; | 262 | return; |
276 | sp.ControllingClient.Kick(reason); | 263 | sp.ControllingClient.Kick(reason); |
277 | sp.Scene.CloseAgent(sp.UUID, true); | 264 | sp.Scene.CloseAgent(sp.UUID, true); |
@@ -286,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
286 | UUID godID = new UUID(msg.fromAgentID); | 273 | UUID godID = new UUID(msg.fromAgentID); |
287 | uint kickMode = (uint)msg.binaryBucket[0]; | 274 | uint kickMode = (uint)msg.binaryBucket[0]; |
288 | 275 | ||
289 | KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason)); | 276 | KickUser(godID, agentID, kickMode, Util.StringToBytes1024(reason)); |
290 | } | 277 | } |
291 | } | 278 | } |
292 | } | 279 | } |