diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/IUserAccountData.cs | 1 | ||||
-rw-r--r-- | OpenSim/Data/Migration.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullUserAccountData.cs | 21 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/Resources/001_UserAccount.sql | 2 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAuthenticationData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserAccountData.cs | 2 |
6 files changed, 27 insertions, 3 deletions
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs index 6ee5995..906ba6c 100644 --- a/OpenSim/Data/IUserAccountData.cs +++ b/OpenSim/Data/IUserAccountData.cs | |||
@@ -48,6 +48,7 @@ namespace OpenSim.Data | |||
48 | { | 48 | { |
49 | UserAccountData[] Get(string[] fields, string[] values); | 49 | UserAccountData[] Get(string[] fields, string[] values); |
50 | bool Store(UserAccountData data); | 50 | bool Store(UserAccountData data); |
51 | bool Delete(string field, string val); | ||
51 | UserAccountData[] GetUsers(UUID scopeID, string query); | 52 | UserAccountData[] GetUsers(UUID scopeID, string query); |
52 | } | 53 | } |
53 | } | 54 | } |
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 4622e23..68e25ef 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs | |||
@@ -146,6 +146,8 @@ namespace OpenSim.Data | |||
146 | { | 146 | { |
147 | m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); | 147 | m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); |
148 | m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); | 148 | m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); |
149 | cmd.CommandText = "ROLLBACK;"; | ||
150 | cmd.ExecuteNonQuery(); | ||
149 | } | 151 | } |
150 | 152 | ||
151 | if (version == 0) | 153 | if (version == 0) |
diff --git a/OpenSim/Data/Null/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs index fc2c5d5..9eb94e6 100644 --- a/OpenSim/Data/Null/NullUserAccountData.cs +++ b/OpenSim/Data/Null/NullUserAccountData.cs | |||
@@ -135,5 +135,26 @@ namespace OpenSim.Data.Null | |||
135 | return result; | 135 | return result; |
136 | } | 136 | } |
137 | 137 | ||
138 | public bool Delete(string field, string val) | ||
139 | { | ||
140 | // Only delete by PrincipalID | ||
141 | if (field.Equals("PrincipalID")) | ||
142 | { | ||
143 | UUID uuid = UUID.Zero; | ||
144 | if (UUID.TryParse(val, out uuid) && m_DataByUUID.ContainsKey(uuid)) | ||
145 | { | ||
146 | UserAccountData account = m_DataByUUID[uuid]; | ||
147 | m_DataByUUID.Remove(uuid); | ||
148 | if (m_DataByName.ContainsKey(account.FirstName + " " + account.LastName)) | ||
149 | m_DataByName.Remove(account.FirstName + " " + account.LastName); | ||
150 | if (account.Data.ContainsKey("Email") && account.Data["Email"] != string.Empty && m_DataByEmail.ContainsKey(account.Data["Email"])) | ||
151 | m_DataByEmail.Remove(account.Data["Email"]); | ||
152 | |||
153 | return true; | ||
154 | } | ||
155 | } | ||
156 | |||
157 | return false; | ||
158 | } | ||
138 | } | 159 | } |
139 | } | 160 | } |
diff --git a/OpenSim/Data/SQLite/Resources/001_UserAccount.sql b/OpenSim/Data/SQLite/Resources/001_UserAccount.sql index f9bf24c..c38d9a7 100644 --- a/OpenSim/Data/SQLite/Resources/001_UserAccount.sql +++ b/OpenSim/Data/SQLite/Resources/001_UserAccount.sql | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | -- useraccounts table | 3 | -- useraccounts table |
4 | CREATE TABLE UserAccounts ( | 4 | CREATE TABLE UserAccounts ( |
5 | PrincipalID CHAR(36) NOT NULL, | 5 | PrincipalID CHAR(36) primary key, |
6 | ScopeID CHAR(36) NOT NULL, | 6 | ScopeID CHAR(36) NOT NULL, |
7 | FirstName VARCHAR(64) NOT NULL, | 7 | FirstName VARCHAR(64) NOT NULL, |
8 | LastName VARCHAR(64) NOT NULL, | 8 | LastName VARCHAR(64) NOT NULL, |
diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs index 2c28375..aa10734 100644 --- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs | |||
@@ -235,7 +235,7 @@ namespace OpenSim.Data.SQLite | |||
235 | if (System.Environment.TickCount - m_LastExpire > 30000) | 235 | if (System.Environment.TickCount - m_LastExpire > 30000) |
236 | DoExpire(); | 236 | DoExpire(); |
237 | 237 | ||
238 | SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now, 'localtime', '+" + lifetime.ToString() + | 238 | SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() + |
239 | " minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')"); | 239 | " minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')"); |
240 | 240 | ||
241 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | 241 | if (ExecuteNonQuery(cmd, m_Connection) > 0) |
diff --git a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs index 50e8c23..67cf716 100644 --- a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite | |||
66 | 66 | ||
67 | if (words.Length == 1) | 67 | if (words.Length == 1) |
68 | { | 68 | { |
69 | cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')", | 69 | cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')", |
70 | m_Realm, scopeID.ToString(), words[0]); | 70 | m_Realm, scopeID.ToString(), words[0]); |
71 | } | 71 | } |
72 | else | 72 | else |