From 447a66d66005c5ec54a786d1d0a532738729251c Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Feb 2012 23:40:56 +0000 Subject: Replace ParcelAccessEntry with a new struct, LandAccessEntry, which more accurately reflects the data sent by the viewer. Add times bans and the expiration of timed bans. Warning: Contains a Migration (and nuts) --- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 12 ++++++------ OpenSim/Data/MySQL/MySQLSimulationData.cs | 17 +++++++++-------- OpenSim/Data/MySQL/Resources/RegionStore.migrations | 6 ++++++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 12 ++++++------ 4 files changed, 27 insertions(+), 20 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index bb59bba..be60d4c 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -681,7 +681,7 @@ VALUES using (SqlCommand cmd = new SqlCommand(sql, conn)) { conn.Open(); - foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList) + foreach (LandAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList) { cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID)); @@ -1453,7 +1453,7 @@ VALUES _Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); } - newData.ParcelAccessList = new List(); + newData.ParcelAccessList = new List(); return newData; } @@ -1463,12 +1463,12 @@ VALUES /// /// datarecord with landaccess data /// - private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row) + private static LandAccessEntry BuildLandAccessData(IDataRecord row) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry entry = new LandAccessEntry(); entry.AgentID = new UUID((Guid)row["AccessUUID"]); entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); - entry.Time = new DateTime(); + entry.Expires = 0; return entry; } @@ -1851,7 +1851,7 @@ VALUES /// parcel access entry. /// parcel ID. /// - private SqlParameter[] CreateLandAccessParameters(ParcelManager.ParcelAccessEntry parcelAccessEntry, UUID parcelID) + private SqlParameter[] CreateLandAccessParameters(LandAccessEntry parcelAccessEntry, UUID parcelID) { List parameters = new List(); diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 3123edf..3275146 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -700,10 +700,10 @@ namespace OpenSim.Data.MySQL cmd.Parameters.Clear(); cmd.CommandText = "insert into landaccesslist (LandUUID, " + - "AccessUUID, Flags) values (?LandUUID, ?AccessUUID, " + - "?Flags)"; + "AccessUUID, Flags, Expires) values (?LandUUID, ?AccessUUID, " + + "?Flags, ?Expires)"; - foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) + foreach (LandAccessEntry entry in parcel.LandData.ParcelAccessList) { FillLandAccessCommand(cmd, entry, parcel.LandData.GlobalID); ExecuteNonQuery(cmd); @@ -1377,7 +1377,7 @@ namespace OpenSim.Data.MySQL newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); - newData.ParcelAccessList = new List(); + newData.ParcelAccessList = new List(); return newData; } @@ -1387,12 +1387,12 @@ namespace OpenSim.Data.MySQL /// /// /// - private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row) + private static LandAccessEntry BuildLandAccessData(IDataReader row) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry entry = new LandAccessEntry(); entry.AgentID = DBGuid.FromDB(row["AccessUUID"]); entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]); - entry.Time = new DateTime(); + entry.Expires = Convert.ToInt32(row["Expires"]); return entry; } @@ -1697,11 +1697,12 @@ namespace OpenSim.Data.MySQL /// /// /// - private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID) + private static void FillLandAccessCommand(MySqlCommand cmd, LandAccessEntry entry, UUID parcelID) { cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString()); cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString()); cmd.Parameters.AddWithValue("Flags", entry.Flags); + cmd.Parameters.AddWithValue("Expires", entry.Expires.ToString()); } /// diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index f9b5737..642e3b7 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -863,3 +863,9 @@ BEGIN; ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; COMMIT; +:VERSION 41 #---------------- Timed bans/access + +BEGIN; +ALTER TABLE `landaccesslist` ADD COLUMN `Expires` INTEGER NOT NULL DEFAULT 0; +COMMIT; + diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 5618772..2d06f82 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -759,7 +759,7 @@ namespace OpenSim.Data.SQLite landaccesslist.Rows.Remove(rowsToDelete[iter]); } rowsToDelete.Clear(); - foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) + foreach (LandAccessEntry entry in parcel.LandData.ParcelAccessList) { DataRow newAccessRow = landaccesslist.NewRow(); fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID); @@ -1456,7 +1456,7 @@ namespace OpenSim.Data.SQLite newData.UserLocation = Vector3.Zero; newData.UserLookAt = Vector3.Zero; } - newData.ParcelAccessList = new List(); + newData.ParcelAccessList = new List(); UUID authBuyerID = UUID.Zero; UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); @@ -1519,12 +1519,12 @@ namespace OpenSim.Data.SQLite /// /// /// - private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) + private static LandAccessEntry buildLandAccessData(DataRow row) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry entry = new LandAccessEntry(); entry.AgentID = new UUID((string) row["AccessUUID"]); entry.Flags = (AccessList) row["Flags"]; - entry.Time = new DateTime(); + entry.Expires = 0; return entry; } @@ -1787,7 +1787,7 @@ namespace OpenSim.Data.SQLite /// /// /// - private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID) + private static void fillLandAccessRow(DataRow row, LandAccessEntry entry, UUID parcelID) { row["LandUUID"] = parcelID.ToString(); row["AccessUUID"] = entry.AgentID.ToString(); -- cgit v1.1