aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorTom2011-01-26 14:20:39 -0800
committerTom2011-01-26 14:20:39 -0800
commit3ecf712e4dd5318442e7c853eb43299840594ce5 (patch)
tree9ba1930ba8f11daddb85e26155b61435e95c4ab8 /OpenSim/Framework
parentRevert my previous SHA1 commit in favour of a better implementation (diff)
downloadopensim-SC_OLD-3ecf712e4dd5318442e7c853eb43299840594ce5.zip
opensim-SC_OLD-3ecf712e4dd5318442e7c853eb43299840594ce5.tar.gz
opensim-SC_OLD-3ecf712e4dd5318442e7c853eb43299840594ce5.tar.bz2
opensim-SC_OLD-3ecf712e4dd5318442e7c853eb43299840594ce5.tar.xz
Add userFlags check to isBanned. This checks bans against DenyAnonymous and DenyMinors. Note that the ban doesn't actually work yet due to some stuff mel's working on .
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/EstateSettings.cs23
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs6
2 files changed, 24 insertions, 5 deletions
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index 2a495b0..f9c13f3 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -338,11 +338,30 @@ namespace OpenSim.Framework
338 return false; 338 return false;
339 } 339 }
340 340
341 public bool IsBanned(UUID avatarID) 341 public bool IsBanned(UUID avatarID, int userFlags)
342 { 342 {
343 foreach (EstateBan ban in l_EstateBans) 343 foreach (EstateBan ban in l_EstateBans)
344 if (ban.BannedUserID == avatarID) 344 if (ban.BannedUserID == avatarID)
345 return true; 345 return true;
346
347 if (!IsEstateManager(avatarID) && !HasAccess(avatarID))
348 {
349 if (DenyMinors)
350 {
351 if ((userFlags & 32) == 0)
352 {
353 return true;
354 }
355 }
356 if (DenyAnonymous)
357 {
358 if ((userFlags & 4) == 0)
359 {
360 return true;
361 }
362 }
363 }
364
346 return false; 365 return false;
347 } 366 }
348 367
@@ -350,7 +369,7 @@ namespace OpenSim.Framework
350 { 369 {
351 if (ban == null) 370 if (ban == null)
352 return; 371 return;
353 if (!IsBanned(ban.BannedUserID)) 372 if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans
354 l_EstateBans.Add(ban); 373 l_EstateBans.Add(ban);
355 } 374 }
356 375
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index e7f8bfc..e131260 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -217,12 +217,12 @@ namespace OpenSim.Framework.Tests
217 BannedHostNameMask = string.Empty, 217 BannedHostNameMask = string.Empty,
218 BannedUserID = bannedUserId} 218 BannedUserID = bannedUserId}
219 ); 219 );
220 Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); 220 Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not.");
221 Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); 221 Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is.");
222 222
223 es.RemoveBan(bannedUserId); 223 es.RemoveBan(bannedUserId);
224 224
225 Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); 225 Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is.");
226 226
227 es.AddEstateManager(UUID.Zero); 227 es.AddEstateManager(UUID.Zero);
228 228