aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs74
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
3 files changed, 71 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 9051194..ae4336c 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -30,6 +30,7 @@ using System.IO;
30using System.Reflection; 30using System.Reflection;
31 31
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Console;
33 34
34using OpenSim.Region.Framework; 35using OpenSim.Region.Framework;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
@@ -80,6 +81,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
80 // } 81 // }
81 // } 82 // }
82 //} 83 //}
84 MainConsole.Instance.Commands.AddCommand("grid", true,
85 "show user-names",
86 "show user-names",
87 "Show the bindings between user UUIDs and user names",
88 String.Empty,
89 HandleShowUsers);
90
91
83 } 92 }
84 93
85 public bool IsSharedModule 94 public bool IsSharedModule
@@ -103,6 +112,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
103 112
104 scene.RegisterModuleInterface<IUserManagement>(this); 113 scene.RegisterModuleInterface<IUserManagement>(this);
105 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); 114 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
115 scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded);
106 } 116 }
107 117
108 public void RemoveRegion(Scene scene) 118 public void RemoveRegion(Scene scene)
@@ -111,18 +121,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
111 m_Scenes.Remove(scene); 121 m_Scenes.Remove(scene);
112 } 122 }
113 123
114 public void RegionLoaded(Scene scene) 124 public void RegionLoaded(Scene s)
115 { 125 {
116 } 126 }
117 127
118 public void PostInitialise() 128 public void PostInitialise()
119 { 129 {
120 foreach (Scene s in m_Scenes)
121 {
122 // let's sniff all the user names referenced by objects in the scene
123 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Caching creators' data from {0} ({1} objects)...", s.RegionInfo.RegionName, s.GetEntities().Length);
124 s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); });
125 }
126 } 130 }
127 131
128 public void Close() 132 public void Close()
@@ -136,6 +140,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
136 140
137 #region Event Handlers 141 #region Event Handlers
138 142
143 void EventManager_OnPrimsLoaded(Scene s)
144 {
145 // let's sniff all the user names referenced by objects in the scene
146 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Caching creators' data from {0} ({1} objects)...", s.RegionInfo.RegionName, s.GetEntities().Length);
147 s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); });
148 }
149
150
139 void EventManager_OnNewClient(IClientAPI client) 151 void EventManager_OnNewClient(IClientAPI client)
140 { 152 {
141 client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); 153 client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest);
@@ -143,7 +155,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
143 155
144 void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) 156 void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
145 { 157 {
146 //m_log.DebugFormat("[XXX] HandleUUIDNameRequest {0}", uuid);
147 if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid)) 158 if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid))
148 { 159 {
149 remote_client.SendNameReply(uuid, "Mr", "OpenSim"); 160 remote_client.SendNameReply(uuid, "Mr", "OpenSim");
@@ -153,6 +164,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
153 string[] names = GetUserNames(uuid); 164 string[] names = GetUserNames(uuid);
154 if (names.Length == 2) 165 if (names.Length == 2)
155 { 166 {
167 //m_log.DebugFormat("[XXX] HandleUUIDNameRequest {0} is {1} {2}", uuid, names[0], names[1]);
156 remote_client.SendNameReply(uuid, names[0], names[1]); 168 remote_client.SendNameReply(uuid, names[0], names[1]);
157 } 169 }
158 170
@@ -254,6 +266,32 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
254 return string.Empty; 266 return string.Empty;
255 } 267 }
256 268
269 public string GetUserUUI(UUID userID)
270 {
271 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID);
272 if (account != null)
273 return userID.ToString();
274
275 if (m_UserCache.ContainsKey(userID))
276 {
277 UserData ud = m_UserCache[userID];
278 string homeURL = ud.HomeURL;
279 string first = ud.FirstName, last = ud.LastName;
280 if (ud.LastName.StartsWith("@"))
281 {
282 string[] parts = ud.FirstName.Split('.');
283 if (parts.Length >= 2)
284 {
285 first = parts[0];
286 last = parts[1];
287 }
288 return userID + ";" + homeURL + ";" + first + " " + last;
289 }
290 }
291
292 return userID.ToString();
293 }
294
257 public void AddUser(UUID id, string creatorData) 295 public void AddUser(UUID id, string creatorData)
258 { 296 {
259 if (m_UserCache.ContainsKey(id)) 297 if (m_UserCache.ContainsKey(id))
@@ -343,5 +381,25 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
343 //} 381 //}
344 382
345 #endregion IUserManagement 383 #endregion IUserManagement
384
385 private void HandleShowUsers(string module, string[] cmd)
386 {
387 if (m_UserCache.Count == 0)
388 {
389 MainConsole.Instance.Output("No users not found");
390 return;
391 }
392
393 MainConsole.Instance.Output("UUID User Name");
394 MainConsole.Instance.Output("-----------------------------------------------------------------------------");
395 foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
396 {
397 MainConsole.Instance.Output(String.Format("{0} {1} {2}",
398 kvp.Key, kvp.Value.FirstName, kvp.Value.LastName));
399 }
400 return;
401 }
402
403
346 } 404 }
347} 405}
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index 9cac3b0..5d30aa8 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -9,6 +9,7 @@ namespace OpenSim.Region.Framework.Interfaces
9 { 9 {
10 string GetUserName(UUID uuid); 10 string GetUserName(UUID uuid);
11 string GetUserHomeURL(UUID uuid); 11 string GetUserHomeURL(UUID uuid);
12 string GetUserUUI(UUID uuid);
12 string GetUserServerURL(UUID uuid, string serverType); 13 string GetUserServerURL(UUID uuid, string serverType);
13 void AddUser(UUID uuid, string userData); 14 void AddUser(UUID uuid, string userData);
14 void AddUser(UUID uuid, string firstName, string lastName, string profileURL); 15 void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f122b58..bdf3d1d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1910,6 +1910,10 @@ namespace OpenSim.Region.Framework.Scenes
1910 sceneObject.SetGroup(groupID, null); 1910 sceneObject.SetGroup(groupID, null);
1911 } 1911 }
1912 1912
1913 IUserManagement uman = RequestModuleInterface<IUserManagement>();
1914 if (uman != null)
1915 sceneObject.RootPart.CreatorIdentification = uman.GetUserUUI(ownerID);
1916
1913 sceneObject.ScheduleGroupForFullUpdate(); 1917 sceneObject.ScheduleGroupForFullUpdate();
1914 1918
1915 return sceneObject; 1919 return sceneObject;