aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-12 19:03:26 +0000
committerJustin Clark-Casey (justincc)2012-01-12 19:03:26 +0000
commit0a1d61950b326abffbcc0b9fe763e1cc6351acf6 (patch)
tree934c0e80e5103c871fdf19f90ee50e0175d14895 /OpenSim/Region
parentrefactor: Move existing npc owner checks to NPCModule.CheckPermissions() meth... (diff)
parentRenamed one var and deleted commented code. No functional changes. (diff)
downloadopensim-SC-0a1d61950b326abffbcc0b9fe763e1cc6351acf6.zip
opensim-SC-0a1d61950b326abffbcc0b9fe763e1cc6351acf6.tar.gz
opensim-SC-0a1d61950b326abffbcc0b9fe763e1cc6351acf6.tar.bz2
opensim-SC-0a1d61950b326abffbcc0b9fe763e1cc6351acf6.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs135
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs8
7 files changed, 78 insertions, 98 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index d20c9eb..eaadc1b 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -55,16 +55,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
55// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); 55// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
56 56
57 private Scene m_scene; 57 private Scene m_scene;
58 private string m_ProfileServerURI; 58 private string m_HomeURI;
59 59
60 #endregion 60 #endregion
61 61
62 #region Constructor 62 #region Constructor
63 63
64 public HGAssetMapper(Scene scene, string profileURL) 64 public HGAssetMapper(Scene scene, string homeURL)
65 { 65 {
66 m_scene = scene; 66 m_scene = scene;
67 m_ProfileServerURI = profileURL; 67 m_HomeURI = homeURL;
68 } 68 }
69 69
70 #endregion 70 #endregion
@@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
150 UUID.TryParse(meta.CreatorID, out uuid); 150 UUID.TryParse(meta.CreatorID, out uuid);
151 UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid); 151 UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
152 if (creator != null) 152 if (creator != null)
153 meta.CreatorID = m_ProfileServerURI + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName; 153 meta.CreatorID = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
154 } 154 }
155 } 155 }
156 156
@@ -193,7 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
193 if (!hasCreatorData && creator != null) 193 if (!hasCreatorData && creator != null)
194 { 194 {
195 XmlElement creatorData = doc.CreateElement("CreatorData"); 195 XmlElement creatorData = doc.CreateElement("CreatorData");
196 creatorData.InnerText = m_ProfileServerURI + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName; 196 creatorData.InnerText = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
197 sop.AppendChild(creatorData); 197 sop.AppendChild(creatorData);
198 } 198 }
199 } 199 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index bf24ebc..0c4ff7f 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
54 get { return m_assMapper; } 54 get { return m_assMapper; }
55 } 55 }
56 56
57 private string m_ProfileServerURI; 57 private string m_HomeURI;
58 private bool m_OutboundPermission; 58 private bool m_OutboundPermission;
59 private string m_ThisGatekeeper; 59 private string m_ThisGatekeeper;
60 60
@@ -84,7 +84,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
84 IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; 84 IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
85 if (thisModuleConfig != null) 85 if (thisModuleConfig != null)
86 { 86 {
87 m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); 87 // legacy configuration [obsolete]
88 m_HomeURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty);
89 // preferred
90 m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI);
88 m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); 91 m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
89 m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty); 92 m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty);
90 } 93 }
@@ -100,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
100 return; 103 return;
101 104
102 base.AddRegion(scene); 105 base.AddRegion(scene);
103 m_assMapper = new HGAssetMapper(scene, m_ProfileServerURI); 106 m_assMapper = new HGAssetMapper(scene, m_HomeURI);
104 scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; 107 scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
105 108
106 } 109 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 37292d6..80ab30c 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -413,68 +413,71 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
413 user.Id = uuid; 413 user.Id = uuid;
414 user.FirstName = first; 414 user.FirstName = first;
415 user.LastName = last; 415 user.LastName = last;
416 // user.ProfileURL = we should initialize this to the default
417 416
418 AddUserInternal(user); 417 AddUserInternal(user);
419 } 418 }
420 419
421 public void AddUser(UUID uuid, string first, string last, string profileURL) 420 public void AddUser(UUID uuid, string first, string last, string homeURL)
422 { 421 {
423 AddUser(uuid, profileURL + ";" + first + " " + last); 422 AddUser(uuid, homeURL + ";" + first + " " + last);
424 } 423 }
425 424
426 public void AddUser(UUID id, string creatorData) 425 public void AddUser (UUID id, string creatorData)
427 { 426 {
428 lock (m_UserCache) 427 UserData oldUser;
429 { 428 //lock the whole block - prevent concurrent update
430 if (m_UserCache.ContainsKey(id)) 429 lock (m_UserCache) {
431 return; 430 m_UserCache.TryGetValue (id, out oldUser);
432 } 431 if (oldUser != null) {
433 432 if (creatorData == null || creatorData == String.Empty) {
434// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); 433 //ignore updates without creator data
435 434 return;
436 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); 435 }
437 436 //try update unknown users
438 if (account != null) 437 //and creator's home URL's
439 { 438 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) {
440 AddUser(id, account.FirstName, account.LastName); 439 m_UserCache.Remove (id);
441 } 440// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL);
442 else 441 } else {
443 { 442 //we have already a valid user within the cache
444 UserData user = new UserData(); 443 return;
445 user.Id = id;
446 user.Flags = -1;
447 user.Created = -1;
448
449 if (creatorData != null && creatorData != string.Empty)
450 {
451 //creatorData = <endpoint>;<name>
452
453 string[] parts = creatorData.Split(';');
454 if (parts.Length >= 1)
455 {
456 user.HomeURL = parts[0];
457 try
458 {
459 Uri uri = new Uri(parts[0]);
460 user.LastName = "@" + uri.Authority;
461 }
462 catch (UriFormatException)
463 {
464 m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]);
465 user.LastName = "@unknown";
466 }
467 } 444 }
468 if (parts.Length >= 2)
469 user.FirstName = parts[1].Replace(' ', '.');
470 } 445 }
471 else 446// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
472 { 447
473 user.FirstName = "Unknown"; 448 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes[0].RegionInfo.ScopeID, id);
474 user.LastName = "User"; 449
450 if (account != null) {
451 AddUser (id, account.FirstName, account.LastName);
452 } else {
453 UserData user = new UserData ();
454 user.Id = id;
455 user.Flags = -1;
456 user.Created = -1;
457
458 if (creatorData != null && creatorData != string.Empty) {
459 //creatorData = <endpoint>;<name>
460
461 string[] parts = creatorData.Split (';');
462 if (parts.Length >= 1) {
463 user.HomeURL = parts[0];
464 try {
465 Uri uri = new Uri (parts[0]);
466 user.LastName = "@" + uri.Authority;
467 } catch (UriFormatException) {
468 m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts[0]);
469 user.LastName = "@unknown";
470 }
471 }
472 if (parts.Length >= 2)
473 user.FirstName = parts[1].Replace (' ', '.');
474 } else {
475 user.FirstName = "Unknown";
476 user.LastName = "User";
477 }
478
479 AddUserInternal (user);
475 } 480 }
476
477 AddUserInternal(user);
478 } 481 }
479 } 482 }
480 483
@@ -488,36 +491,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
488// user.Id, user.FirstName, user.LastName, user.HomeURL); 491// user.Id, user.FirstName, user.LastName, user.HomeURL);
489 } 492 }
490 493
491 //public void AddUser(UUID uuid, string userData)
492 //{
493 // if (m_UserCache.ContainsKey(uuid))
494 // return;
495
496 // UserData user = new UserData();
497 // user.Id = uuid;
498
499 // // userData = <profile url>;<name>
500 // string[] parts = userData.Split(';');
501 // if (parts.Length >= 1)
502 // user.ProfileURL = parts[0].Trim();
503 // if (parts.Length >= 2)
504 // {
505 // string[] name = parts[1].Trim().Split(' ');
506 // if (name.Length >= 1)
507 // user.FirstName = name[0];
508 // if (name.Length >= 2)
509 // user.LastName = name[1];
510 // else
511 // user.LastName = "?";
512 // }
513
514 // lock (m_UserCache)
515 // m_UserCache.Add(uuid, user);
516
517 // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL);
518
519 //}
520
521 public bool IsLocalGridUser(UUID uuid) 494 public bool IsLocalGridUser(UUID uuid)
522 { 495 {
523 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); 496 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index f44a3ba..0707cbe 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -125,8 +125,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
125 Dictionary<string, object> options = new Dictionary<string, object>(); 125 Dictionary<string, object> options = new Dictionary<string, object>();
126 126
127 OptionSet ops = new OptionSet(); 127 OptionSet ops = new OptionSet();
128// ops.Add("v|version=", delegate(string v) { options["version"] = v; }); 128
129 ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); 129 // legacy argument [obsolete]
130 ops.Add("p|profile=", delegate(string v) { Console.WriteLine("\n WARNING: -profile option is obsolete and it will not work. Use -home instead.\n"); });
131 // preferred
132 ops.Add("h|home=", delegate(string v) { options["home"] = v; });
133
130 ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); 134 ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
131 ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; }); 135 ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
132 136
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index 54dfaf4..4f62e28 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Interfaces
50 /// <param name="uuid"></param> 50 /// <param name="uuid"></param>
51 /// <param name="firstName"></param> 51 /// <param name="firstName"></param>
52 /// <param name="profileURL"></param> 52 /// <param name="profileURL"></param>
53 void AddUser(UUID uuid, string firstName, string lastName, string profileURL); 53 void AddUser(UUID uuid, string firstName, string lastName, string homeURL);
54 54
55 bool IsLocalGridUser(UUID uuid); 55 bool IsLocalGridUser(UUID uuid);
56 } 56 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 51d3586..e9c33eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -394,7 +394,7 @@ namespace OpenSim.Region.Framework.Scenes
394 394
395 private string m_creatorData = string.Empty; 395 private string m_creatorData = string.Empty;
396 /// <summary> 396 /// <summary>
397 /// Data about the creator in the form profile_url;name 397 /// Data about the creator in the form home_url;name
398 /// </summary> 398 /// </summary>
399 public string CreatorData 399 public string CreatorData
400 { 400 {
@@ -405,7 +405,7 @@ namespace OpenSim.Region.Framework.Scenes
405 /// <summary> 405 /// <summary>
406 /// Used by the DB layer to retrieve / store the entire user identification. 406 /// Used by the DB layer to retrieve / store the entire user identification.
407 /// The identification can either be a simple UUID or a string of the form 407 /// The identification can either be a simple UUID or a string of the form
408 /// uuid[;profile_url[;name]] 408 /// uuid[;home_url[;name]]
409 /// </summary> 409 /// </summary>
410 public string CreatorIdentification 410 public string CreatorIdentification
411 { 411 {
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 38d1231..7c60ddd 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1134,12 +1134,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1134 1134
1135 if (sop.CreatorData != null && sop.CreatorData != string.Empty) 1135 if (sop.CreatorData != null && sop.CreatorData != string.Empty)
1136 writer.WriteElementString("CreatorData", sop.CreatorData); 1136 writer.WriteElementString("CreatorData", sop.CreatorData);
1137 else if (options.ContainsKey("profile")) 1137 else if (options.ContainsKey("home"))
1138 { 1138 {
1139 if (m_UserManagement == null) 1139 if (m_UserManagement == null)
1140 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); 1140 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
1141 string name = m_UserManagement.GetUserName(sop.CreatorID); 1141 string name = m_UserManagement.GetUserName(sop.CreatorID);
1142 writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name); 1142 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name);
1143 } 1143 }
1144 1144
1145 WriteUUID(writer, "FolderID", sop.FolderID, options); 1145 WriteUUID(writer, "FolderID", sop.FolderID, options);
@@ -1282,12 +1282,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1282 1282
1283 if (item.CreatorData != null && item.CreatorData != string.Empty) 1283 if (item.CreatorData != null && item.CreatorData != string.Empty)
1284 writer.WriteElementString("CreatorData", item.CreatorData); 1284 writer.WriteElementString("CreatorData", item.CreatorData);
1285 else if (options.ContainsKey("profile")) 1285 else if (options.ContainsKey("home"))
1286 { 1286 {
1287 if (m_UserManagement == null) 1287 if (m_UserManagement == null)
1288 m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); 1288 m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
1289 string name = m_UserManagement.GetUserName(item.CreatorID); 1289 string name = m_UserManagement.GetUserName(item.CreatorID);
1290 writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name); 1290 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name);
1291 } 1291 }
1292 1292
1293 writer.WriteElementString("Description", item.Description); 1293 writer.WriteElementString("Description", item.Description);