aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserProfilesService
diff options
context:
space:
mode:
authorBlueWall2013-05-13 22:11:28 -0400
committerBlueWall2013-05-30 17:59:18 -0400
commit328883700a15e4216bf7b251ac099d38f413375e (patch)
treefc90ce9fe8f7b1c5caca393144eac5b2824a9f3a /OpenSim/Services/UserProfilesService
parentminor: fix warnings in GodsModule that were due to duplicate using statements (diff)
downloadopensim-SC-328883700a15e4216bf7b251ac099d38f413375e.zip
opensim-SC-328883700a15e4216bf7b251ac099d38f413375e.tar.gz
opensim-SC-328883700a15e4216bf7b251ac099d38f413375e.tar.bz2
opensim-SC-328883700a15e4216bf7b251ac099d38f413375e.tar.xz
UserProfiles
UserProfiles for Robust and Standalone. Includes service and connectors for Robust and standalone opensim plus matching region module.
Diffstat (limited to 'OpenSim/Services/UserProfilesService')
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesService.cs160
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs59
2 files changed, 219 insertions, 0 deletions
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
new file mode 100644
index 0000000..959c661
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
@@ -0,0 +1,160 @@
1using System;
2using System.Reflection;
3using System.Text;
4using Nini.Config;
5using log4net;
6using OpenSim.Server.Base;
7using OpenSim.Services.Interfaces;
8using OpenSim.Services.UserAccountService;
9using OpenSim.Data;
10using OpenMetaverse;
11using OpenMetaverse.StructuredData;
12using OpenSim.Framework;
13
14namespace OpenSim.Services.ProfilesService
15{
16 public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService
17 {
18 static readonly ILog m_log =
19 LogManager.GetLogger(
20 MethodBase.GetCurrentMethod().DeclaringType);
21
22 IUserAccountService userAccounts;
23 IAuthenticationService authService;
24
25 public UserProfilesService(IConfigSource config, string configName):
26 base(config, configName)
27 {
28 IConfig Config = config.Configs[configName];
29 if (Config == null)
30 {
31 m_log.Warn("[PROFILES]: No configuration found!");
32 return;
33 }
34 Object[] args = null;
35
36 args = new Object[] { config };
37 string accountService = Config.GetString("UserAccountService", String.Empty);
38 if (accountService != string.Empty)
39 userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
40
41 args = new Object[] { config };
42 string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty);
43 if (accountService != string.Empty)
44 authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args);
45 }
46
47 #region Classifieds
48 public OSD AvatarClassifiedsRequest(UUID creatorId)
49 {
50 OSDArray records = ProfilesData.GetClassifiedRecords(creatorId);
51
52 return records;
53 }
54
55 public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result)
56 {
57 if(!ProfilesData.UpdateClassifiedRecord(ad, ref result))
58 {
59 return false;
60 }
61 result = "success";
62 return true;
63 }
64
65 public bool ClassifiedDelete(UUID recordId)
66 {
67 if(ProfilesData.DeleteClassifiedRecord(recordId))
68 return true;
69
70 return false;
71 }
72
73 public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result)
74 {
75 if(ProfilesData.GetClassifiedInfo(ref ad, ref result))
76 return true;
77
78 return false;
79 }
80 #endregion Classifieds
81
82 #region Picks
83 public OSD AvatarPicksRequest(UUID creatorId)
84 {
85 OSDArray records = ProfilesData.GetAvatarPicks(creatorId);
86
87 return records;
88 }
89
90 public bool PickInfoRequest(ref UserProfilePick pick, ref string result)
91 {
92 pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId);
93 result = "OK";
94 return true;
95 }
96
97 public bool PicksUpdate(ref UserProfilePick pick, ref string result)
98 {
99 return ProfilesData.UpdatePicksRecord(pick);
100 }
101
102 public bool PicksDelete(UUID pickId)
103 {
104 return ProfilesData.DeletePicksRecord(pickId);
105 }
106 #endregion Picks
107
108 #region Notes
109 public bool AvatarNotesRequest(ref UserProfileNotes note)
110 {
111 return ProfilesData.GetAvatarNotes(ref note);
112 }
113
114 public bool NotesUpdate(ref UserProfileNotes note, ref string result)
115 {
116 return ProfilesData.UpdateAvatarNotes(ref note, ref result);
117 }
118 #endregion Notes
119
120 #region Profile Properties
121 public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result)
122 {
123 return ProfilesData.GetAvatarProperties(ref prop, ref result);
124 }
125
126 public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result)
127 {
128 return ProfilesData.UpdateAvatarProperties(ref prop, ref result);
129 }
130 #endregion Profile Properties
131
132 #region Interests
133 public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result)
134 {
135 return ProfilesData.UpdateAvatarInterests(prop, ref result);
136 }
137 #endregion Interests
138
139 #region Utility
140 public OSD AvatarImageAssetsRequest(UUID avatarId)
141 {
142 OSDArray records = ProfilesData.GetUserImageAssets(avatarId);
143 return records;
144 }
145 #endregion Utility
146
147 #region UserData
148 public bool RequestUserAppData(ref UserAppData prop, ref string result)
149 {
150 return ProfilesData.GetUserAppData(ref prop, ref result);
151 }
152
153 public bool SetUserAppData(UserAppData prop, ref string result)
154 {
155 return true;
156 }
157 #endregion UserData
158 }
159}
160
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
new file mode 100644
index 0000000..dc0be03
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
@@ -0,0 +1,59 @@
1using System;
2using System.Reflection;
3using Nini.Config;
4using log4net;
5using OpenSim.Services.Base;
6using OpenSim.Data;
7
8namespace OpenSim.Services.ProfilesService
9{
10 public class UserProfilesServiceBase: ServiceBase
11 {
12 static readonly ILog m_log =
13 LogManager.GetLogger(
14 MethodBase.GetCurrentMethod().DeclaringType);
15
16 public IProfilesData ProfilesData;
17
18 public string ConfigName
19 {
20 get; private set;
21 }
22
23 public UserProfilesServiceBase(IConfigSource config, string configName):
24 base(config)
25 {
26 if(string.IsNullOrEmpty(configName))
27 {
28 m_log.WarnFormat("[PROFILES]: Configuration section not given!");
29 return;
30 }
31
32 string dllName = String.Empty;
33 string connString = null;
34 string realm = String.Empty;
35
36 IConfig dbConfig = config.Configs["DatabaseService"];
37 if (dbConfig != null)
38 {
39 if (dllName == String.Empty)
40 dllName = dbConfig.GetString("StorageProvider", String.Empty);
41 if (string.IsNullOrEmpty(connString))
42 connString = dbConfig.GetString("ConnectionString", String.Empty);
43 }
44
45 IConfig ProfilesConfig = config.Configs[configName];
46 if (ProfilesConfig != null)
47 {
48 connString = ProfilesConfig.GetString("ConnectionString", connString);
49 realm = ProfilesConfig.GetString("Realm", realm);
50 }
51
52 ProfilesData = LoadPlugin<IProfilesData>(dllName, new Object[] { connString });
53 if (ProfilesData == null)
54 throw new Exception("Could not find a storage interface in the given module");
55
56 }
57 }
58}
59