diff options
author | Melanie | 2009-12-31 01:16:16 +0000 |
---|---|---|
committer | Melanie | 2009-12-31 01:16:16 +0000 |
commit | 3507005d9decdbf579fb2b7b9928a7d97bd6cf5b (patch) | |
tree | d4b6c1ed6928f54fedb3dd0bf5371c7c38a66c55 /OpenSim/Services | |
parent | Make ScopeID be wild on user queries. Just pass it as UUID.Zero (diff) | |
download | opensim-SC_OLD-3507005d9decdbf579fb2b7b9928a7d97bd6cf5b.zip opensim-SC_OLD-3507005d9decdbf579fb2b7b9928a7d97bd6cf5b.tar.gz opensim-SC_OLD-3507005d9decdbf579fb2b7b9928a7d97bd6cf5b.tar.bz2 opensim-SC_OLD-3507005d9decdbf579fb2b7b9928a7d97bd6cf5b.tar.xz |
Remove CreateUserAccount. Rename SetUserAccount to StoreUserAccount.
Implement the fetch operations fully. Rename one last UserService file to
UserAccountService
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs | 15 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IUserAccountService.cs (renamed from OpenSim/Services/Interfaces/IUserService.cs) | 8 | ||||
-rw-r--r-- | OpenSim/Services/UserAccountService/UserAccountService.cs | 82 |
3 files changed, 71 insertions, 34 deletions
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index d4b906a..46313d9 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs | |||
@@ -186,7 +186,7 @@ namespace OpenSim.Services.Connectors | |||
186 | return accounts; | 186 | return accounts; |
187 | } | 187 | } |
188 | 188 | ||
189 | public bool SetUserAccount(UserAccount data) | 189 | public bool StoreUserAccount(UserAccount data) |
190 | { | 190 | { |
191 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 191 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
192 | //sendData["SCOPEID"] = scopeID.ToString(); | 192 | //sendData["SCOPEID"] = scopeID.ToString(); |
@@ -199,19 +199,6 @@ namespace OpenSim.Services.Connectors | |||
199 | return SendAndGetBoolReply(sendData); | 199 | return SendAndGetBoolReply(sendData); |
200 | } | 200 | } |
201 | 201 | ||
202 | public bool CreateUserAccount(UserAccount data) | ||
203 | { | ||
204 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
205 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
206 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
207 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
208 | sendData["METHOD"] = "createaccount"; | ||
209 | |||
210 | sendData["account"] = data.ToKeyValuePairs(); | ||
211 | |||
212 | return SendAndGetBoolReply(sendData); | ||
213 | } | ||
214 | |||
215 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) | 202 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) |
216 | { | 203 | { |
217 | string reply = string.Empty; | 204 | string reply = string.Empty; |
diff --git a/OpenSim/Services/Interfaces/IUserService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 1bdaaab..b2d5d48 100644 --- a/OpenSim/Services/Interfaces/IUserService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs | |||
@@ -95,11 +95,9 @@ namespace OpenSim.Services.Interfaces | |||
95 | // | 95 | // |
96 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); | 96 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); |
97 | 97 | ||
98 | // Update all updatable fields | 98 | // Store the data given, wich replaces the sotred data, therefore |
99 | // must be complete. | ||
99 | // | 100 | // |
100 | bool SetUserAccount(UserAccount data); | 101 | bool StoreUserAccount(UserAccount data); |
101 | |||
102 | // Creates a user data record | ||
103 | bool CreateUserAccount(UserAccount data); | ||
104 | } | 102 | } |
105 | } | 103 | } |
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 0270f9d..706da84 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -62,33 +62,85 @@ namespace OpenSim.Services.UserAccountService | |||
62 | if (d.Length < 1) | 62 | if (d.Length < 1) |
63 | return null; | 63 | return null; |
64 | 64 | ||
65 | return MakeUserAccount(d[0]); | ||
66 | } | ||
67 | |||
68 | private UserAccount MakeUserAccount(UserAccountData d) | ||
69 | { | ||
65 | UserAccount u = new UserAccount(); | 70 | UserAccount u = new UserAccount(); |
66 | u.FirstName = d[0].FirstName; | 71 | u.FirstName = d.FirstName; |
67 | u.LastName = d[0].LastName; | 72 | u.LastName = d.LastName; |
68 | u.PrincipalID = d[0].PrincipalID; | 73 | u.PrincipalID = d.PrincipalID; |
69 | u.ScopeID = d[0].ScopeID; | 74 | u.ScopeID = d.ScopeID; |
70 | u.Email = d[0].Data["Email"].ToString(); | 75 | u.Email = d.Data["Email"].ToString(); |
71 | u.Created = Convert.ToInt32(d[0].Data["Created"].ToString()); | 76 | u.Created = Convert.ToInt32(d.Data["Created"].ToString()); |
72 | 77 | ||
73 | return null; | 78 | string[] URLs = d.Data["ServiceURLs"].ToString().Split(new char[] {' '}); |
79 | u.ServiceURLs = new Dictionary<string, object>(); | ||
80 | |||
81 | foreach(string url in URLs) | ||
82 | { | ||
83 | string[] parts = url.Split(new char[] {'='}); | ||
84 | |||
85 | if (parts.Length != 2) | ||
86 | continue; | ||
87 | |||
88 | string name = System.Web.HttpUtility.UrlDecode(parts[0]); | ||
89 | string val = System.Web.HttpUtility.UrlDecode(parts[1]); | ||
90 | |||
91 | u.ServiceURLs[name] = val; | ||
92 | } | ||
93 | |||
94 | return u; | ||
74 | } | 95 | } |
75 | 96 | ||
76 | public UserAccount GetUserAccount(UUID scopeID, string email) | 97 | public UserAccount GetUserAccount(UUID scopeID, string email) |
77 | { | 98 | { |
78 | return null; | 99 | UserAccountData[] d; |
100 | |||
101 | if (scopeID != UUID.Zero) | ||
102 | { | ||
103 | d = m_Database.Get( | ||
104 | new string[] {"ScopeID", "Email"}, | ||
105 | new string[] {scopeID.ToString(), email}); | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | d = m_Database.Get( | ||
110 | new string[] {"Email"}, | ||
111 | new string[] {email}); | ||
112 | } | ||
113 | |||
114 | if (d.Length < 1) | ||
115 | return null; | ||
116 | |||
117 | return MakeUserAccount(d[0]); | ||
79 | } | 118 | } |
80 | 119 | ||
81 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | 120 | public UserAccount GetUserAccount(UUID scopeID, UUID principalID) |
82 | { | 121 | { |
83 | return null; | 122 | UserAccountData[] d; |
84 | } | ||
85 | 123 | ||
86 | public bool SetUserAccount(UserAccount data) | 124 | if (scopeID != UUID.Zero) |
87 | { | 125 | { |
88 | return false; | 126 | d = m_Database.Get( |
127 | new string[] {"ScopeID", "PrincipalID"}, | ||
128 | new string[] {scopeID.ToString(), principalID.ToString()}); | ||
129 | } | ||
130 | else | ||
131 | { | ||
132 | d = m_Database.Get( | ||
133 | new string[] {"PrincipalID"}, | ||
134 | new string[] {principalID.ToString()}); | ||
135 | } | ||
136 | |||
137 | if (d.Length < 1) | ||
138 | return null; | ||
139 | |||
140 | return MakeUserAccount(d[0]); | ||
89 | } | 141 | } |
90 | 142 | ||
91 | public bool CreateUserAccount(UserAccount data) | 143 | public bool StoreUserAccount(UserAccount data) |
92 | { | 144 | { |
93 | return false; | 145 | return false; |
94 | } | 146 | } |