aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Interfaces/IUserAccountService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Interfaces/IUserAccountService.cs')
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs123
1 files changed, 123 insertions, 0 deletions
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
new file mode 100644
index 0000000..87f0e6c
--- /dev/null
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -0,0 +1,123 @@
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
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31
32namespace 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)
70 {
71 ServiceURLs = new Dictionary<string, object>();
72 string str = kvp["ServiceURLs"].ToString();
73 if (str != string.Empty)
74 {
75 string[] parts = str.Split(new char[] { '#' });
76 Dictionary<string, object> dic = new Dictionary<string, object>();
77 foreach (string s in parts)
78 {
79 string[] parts2 = s.Split(new char[] { '=' });
80 if (parts2.Length == 2)
81 ServiceURLs[parts2[0]] = parts2[1];
82 }
83 }
84 }
85 }
86
87 public Dictionary<string, object> ToKeyValuePairs()
88 {
89 Dictionary<string, object> result = new Dictionary<string, object>();
90 result["FirstName"] = FirstName;
91 result["LastName"] = LastName;
92 result["Email"] = Email;
93 result["PrincipalID"] = PrincipalID.ToString();
94 result["ScopeID"] = ScopeID.ToString();
95 result["Created"] = Created.ToString();
96 string str = string.Empty;
97 foreach (KeyValuePair<string, object> kvp in ServiceURLs)
98 {
99 str += kvp.Key + "=" + kvp.Value + "#";
100 }
101 result["ServiceURLs"] = str;
102
103 return result;
104 }
105
106 };
107
108 public interface IUserAccountService
109 {
110 UserAccount GetUserAccount(UUID scopeID, UUID userID);
111 UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName);
112 UserAccount GetUserAccount(UUID scopeID, string Email);
113 // Returns the list of avatars that matches both the search
114 // criterion and the scope ID passed
115 //
116 List<UserAccount> GetUserAccounts(UUID scopeID, string query);
117
118 // Store the data given, wich replaces the sotred data, therefore
119 // must be complete.
120 //
121 bool StoreUserAccount(UserAccount data);
122 }
123}