diff options
author | Diva Canto | 2009-12-30 21:00:52 -0800 |
---|---|---|
committer | Diva Canto | 2009-12-30 21:00:52 -0800 |
commit | c664307126e7869f6e7038173561de57be058104 (patch) | |
tree | 848f6fad19abdc65cb7c76a4eff67c8de453038a /OpenSim/Services/Interfaces/IUserAccountService.cs | |
parent | First pass at the new login service. Still incomplete, but doesn't disrupt th... (diff) | |
parent | Implement avatar picker queries (diff) | |
download | opensim-SC_OLD-c664307126e7869f6e7038173561de57be058104.zip opensim-SC_OLD-c664307126e7869f6e7038173561de57be058104.tar.gz opensim-SC_OLD-c664307126e7869f6e7038173561de57be058104.tar.bz2 opensim-SC_OLD-c664307126e7869f6e7038173561de57be058104.tar.xz |
Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/opensim into presence-refactor
Diffstat (limited to 'OpenSim/Services/Interfaces/IUserAccountService.cs')
-rw-r--r-- | OpenSim/Services/Interfaces/IUserAccountService.cs | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs new file mode 100644 index 0000000..b2d5d48 --- /dev/null +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | public class UserAccount | ||
35 | { | ||
36 | public UserAccount() | ||
37 | { | ||
38 | } | ||
39 | |||
40 | public UserAccount(UUID principalID) | ||
41 | { | ||
42 | PrincipalID = principalID; | ||
43 | } | ||
44 | |||
45 | public string FirstName; | ||
46 | public string LastName; | ||
47 | public string Email; | ||
48 | public UUID PrincipalID; | ||
49 | public UUID ScopeID; | ||
50 | |||
51 | public Dictionary<string, object> ServiceURLs; | ||
52 | |||
53 | public int Created; | ||
54 | |||
55 | public UserAccount(Dictionary<string, object> kvp) | ||
56 | { | ||
57 | if (kvp.ContainsKey("FirstName")) | ||
58 | FirstName = kvp["FirstName"].ToString(); | ||
59 | if (kvp.ContainsKey("LastName")) | ||
60 | LastName = kvp["LastName"].ToString(); | ||
61 | if (kvp.ContainsKey("Email")) | ||
62 | Email = kvp["Email"].ToString(); | ||
63 | if (kvp.ContainsKey("PrincipalID")) | ||
64 | UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); | ||
65 | if (kvp.ContainsKey("ScopeID")) | ||
66 | UUID.TryParse(kvp["ScopeID"].ToString(), out ScopeID); | ||
67 | if (kvp.ContainsKey("Created")) | ||
68 | Convert.ToInt32(kvp["Created"].ToString()); | ||
69 | if (kvp.ContainsKey("ServiceURLs") && kvp["ServiceURLs"] != null && (kvp["ServiceURLs"] is Dictionary<string, string>)) | ||
70 | ServiceURLs = (Dictionary<string, object>)kvp["ServiceURLs"]; | ||
71 | } | ||
72 | |||
73 | public Dictionary<string, object> ToKeyValuePairs() | ||
74 | { | ||
75 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
76 | result["FirstName"] = FirstName; | ||
77 | result["LastName"] = LastName; | ||
78 | result["Email"] = Email; | ||
79 | result["PrincipalID"] = PrincipalID.ToString(); | ||
80 | result["ScopeID"] = ScopeID.ToString(); | ||
81 | result["Created"] = Created.ToString(); | ||
82 | result["ServiceURLs"] = ServiceURLs; | ||
83 | |||
84 | return result; | ||
85 | } | ||
86 | }; | ||
87 | |||
88 | public interface IUserAccountService | ||
89 | { | ||
90 | UserAccount GetUserAccount(UUID scopeID, UUID userID); | ||
91 | UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); | ||
92 | UserAccount GetUserAccount(UUID scopeID, string Email); | ||
93 | // Returns the list of avatars that matches both the search | ||
94 | // criterion and the scope ID passed | ||
95 | // | ||
96 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); | ||
97 | |||
98 | // Store the data given, wich replaces the sotred data, therefore | ||
99 | // must be complete. | ||
100 | // | ||
101 | bool StoreUserAccount(UserAccount data); | ||
102 | } | ||
103 | } | ||