diff options
Diffstat (limited to 'OpenSim/Addons/Groups/Service')
-rw-r--r-- | OpenSim/Addons/Groups/Service/GroupsService.cs | 15 | ||||
-rw-r--r-- | OpenSim/Addons/Groups/Service/GroupsServiceBase.cs | 103 |
2 files changed, 75 insertions, 43 deletions
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs index 4da7233..07641ef 100644 --- a/OpenSim/Addons/Groups/Service/GroupsService.cs +++ b/OpenSim/Addons/Groups/Service/GroupsService.cs | |||
@@ -307,6 +307,21 @@ namespace OpenSim.Groups | |||
307 | m.Contribution = Int32.Parse(d.Data["Contribution"]); | 307 | m.Contribution = Int32.Parse(d.Data["Contribution"]); |
308 | m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false; | 308 | m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false; |
309 | 309 | ||
310 | GridUserData gud = m_GridUserService.Get(d.PrincipalID); | ||
311 | if (gud != null) | ||
312 | { | ||
313 | if (bool.Parse(gud.Data["Online"])) | ||
314 | { | ||
315 | m.OnlineStatus = @"Online"; | ||
316 | } | ||
317 | else | ||
318 | { | ||
319 | int unixtime = int.Parse(gud.Data["Login"]); | ||
320 | // The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates! | ||
321 | m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy"); | ||
322 | } | ||
323 | } | ||
324 | |||
310 | // Is this person an owner of the group? | 325 | // Is this person an owner of the group? |
311 | m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false; | 326 | m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false; |
312 | 327 | ||
diff --git a/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs b/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs index 2611a3d..8e237aa 100644 --- a/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs +++ b/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -35,50 +35,67 @@ using OpenSim.Services.Base; | |||
35 | 35 | ||
36 | namespace OpenSim.Groups | 36 | namespace OpenSim.Groups |
37 | { | 37 | { |
38 | public class GroupsServiceBase : ServiceBase | 38 | public class GroupsServiceBase : ServiceBase |
39 | { | 39 | { |
40 | protected IGroupsData m_Database = null; | 40 | protected IGroupsData m_Database = null; |
41 | protected IGridUserData m_GridUserService = null; | ||
41 | 42 | ||
42 | public GroupsServiceBase(IConfigSource config, string cName) | 43 | public GroupsServiceBase(IConfigSource config, string cName) |
43 | : base(config) | 44 | : base(config) |
44 | { | 45 | { |
45 | string dllName = String.Empty; | 46 | string dllName = String.Empty; |
46 | string connString = String.Empty; | 47 | string connString = String.Empty; |
47 | string realm = "os_groups"; | 48 | string realm = "os_groups"; |
48 | string configName = (cName == string.Empty) ? "Groups" : cName; | 49 | string usersRealm = "GridUser"; |
50 | string configName = (cName == string.Empty) ? "Groups" : cName; | ||
49 | 51 | ||
50 | // | 52 | // |
51 | // Try reading the [DatabaseService] section, if it exists | 53 | // Try reading the [DatabaseService] section, if it exists |
52 | // | 54 | // |
53 | IConfig dbConfig = config.Configs["DatabaseService"]; | 55 | IConfig dbConfig = config.Configs["DatabaseService"]; |
54 | if (dbConfig != null) | 56 | if (dbConfig != null) |
55 | { | 57 | { |
56 | if (dllName == String.Empty) | 58 | if (dllName == String.Empty) |
57 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | 59 | dllName = dbConfig.GetString("StorageProvider", String.Empty); |
58 | if (connString == String.Empty) | 60 | if (connString == String.Empty) |
59 | connString = dbConfig.GetString("ConnectionString", String.Empty); | 61 | connString = dbConfig.GetString("ConnectionString", String.Empty); |
60 | } | 62 | } |
61 | 63 | ||
62 | // | 64 | // |
63 | // [Groups] section overrides [DatabaseService], if it exists | 65 | // [Groups] section overrides [DatabaseService], if it exists |
64 | // | 66 | // |
65 | IConfig groupsConfig = config.Configs[configName]; | 67 | IConfig groupsConfig = config.Configs[configName]; |
66 | if (groupsConfig != null) | 68 | if (groupsConfig != null) |
67 | { | 69 | { |
68 | dllName = groupsConfig.GetString("StorageProvider", dllName); | 70 | dllName = groupsConfig.GetString("StorageProvider", dllName); |
69 | connString = groupsConfig.GetString("ConnectionString", connString); | 71 | connString = groupsConfig.GetString("ConnectionString", connString); |
70 | realm = groupsConfig.GetString("Realm", realm); | 72 | realm = groupsConfig.GetString("Realm", realm); |
71 | } | 73 | } |
72 | 74 | ||
73 | // | 75 | // |
74 | // We tried, but this doesn't exist. We can't proceed. | 76 | // We tried, but this doesn't exist. We can't proceed. |
75 | // | 77 | // |
76 | if (dllName.Equals(String.Empty)) | 78 | if (dllName.Equals(String.Empty)) |
77 | throw new Exception("No StorageProvider configured"); | 79 | throw new Exception("No StorageProvider configured"); |
78 | 80 | ||
79 | m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm }); | 81 | m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm }); |
80 | if (m_Database == null) | 82 | if (m_Database == null) |
81 | throw new Exception("Could not find a storage interface in the given module " + dllName); | 83 | throw new Exception("Could not find a storage interface in the given module " + dllName); |
82 | } | 84 | |
83 | } | 85 | // |
84 | } \ No newline at end of file | 86 | // [GridUserService] section overrides [DatabaseService], if it exists |
87 | // | ||
88 | IConfig usersConfig = config.Configs["GridUserService"]; | ||
89 | if (usersConfig != null) | ||
90 | { | ||
91 | dllName = usersConfig.GetString("StorageProvider", dllName); | ||
92 | connString = usersConfig.GetString("ConnectionString", connString); | ||
93 | usersRealm = usersConfig.GetString("Realm", usersRealm); | ||
94 | } | ||
95 | |||
96 | m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm }); | ||
97 | if (m_GridUserService == null) | ||
98 | throw new Exception("Could not find a storage inferface for the given users module " + dllName); | ||
99 | } | ||
100 | } | ||
101 | } | ||