HG: normalize all externalized user ULRs to be the Home URL, i.e. the location of the user's UAS. This corrects an earlier design which had some cases pointing to the profile server. WARNING: CONFIGURATION CHANGES in both the sims (*Common.ini) and the Robust configs (Robust.HG.ini). Please check diff of the example files, but basically all vars that were pointing to profile should point to the UAS instead and should be called HomeURI.

iar_mods
Diva Canto 2012-01-12 09:56:35 -08:00
parent 34137ed4ea
commit 8bdd80abfa
11 changed files with 46 additions and 33 deletions

View File

@ -44,13 +44,13 @@ namespace OpenSim.Framework.Serialization.External
/// with creator data added to it. /// with creator data added to it.
/// </summary> /// </summary>
/// <param name="xml">The SceneObjectPart represented in XML2</param> /// <param name="xml">The SceneObjectPart represented in XML2</param>
/// <param name="profileURL">The URL of the profile service for the creator</param> /// <param name="homeURL">The URL of the user agents service (home) for the creator</param>
/// <param name="userService">The service for retrieving user account information</param> /// <param name="userService">The service for retrieving user account information</param>
/// <param name="scopeID">The scope of the user account information (Grid ID)</param> /// <param name="scopeID">The scope of the user account information (Grid ID)</param>
/// <returns>The SceneObjectPart represented in XML2</returns> /// <returns>The SceneObjectPart represented in XML2</returns>
public static string RewriteSOP(string xml, string profileURL, IUserAccountService userService, UUID scopeID) public static string RewriteSOP(string xml, string homeURL, IUserAccountService userService, UUID scopeID)
{ {
if (xml == string.Empty || profileURL == string.Empty || userService == null) if (xml == string.Empty || homeURL == string.Empty || userService == null)
return xml; return xml;
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
@ -83,7 +83,7 @@ namespace OpenSim.Framework.Serialization.External
if (!hasCreatorData && creator != null) if (!hasCreatorData && creator != null)
{ {
XmlElement creatorData = doc.CreateElement("CreatorData"); XmlElement creatorData = doc.CreateElement("CreatorData");
creatorData.InnerText = profileURL + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName; creatorData.InnerText = homeURL + ";" + creator.FirstName + " " + creator.LastName;
sop.AppendChild(creatorData); sop.AppendChild(creatorData);
} }
} }

View File

@ -55,16 +55,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); // private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
private Scene m_scene; private Scene m_scene;
private string m_ProfileServerURI; private string m_HomeURI;
#endregion #endregion
#region Constructor #region Constructor
public HGAssetMapper(Scene scene, string profileURL) public HGAssetMapper(Scene scene, string homeURL)
{ {
m_scene = scene; m_scene = scene;
m_ProfileServerURI = profileURL; m_HomeURI = homeURL;
} }
#endregion #endregion
@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
UUID.TryParse(meta.CreatorID, out uuid); UUID.TryParse(meta.CreatorID, out uuid);
UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid); UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
if (creator != null) if (creator != null)
meta.CreatorID = m_ProfileServerURI + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName; meta.CreatorID = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
} }
} }
@ -193,7 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (!hasCreatorData && creator != null) if (!hasCreatorData && creator != null)
{ {
XmlElement creatorData = doc.CreateElement("CreatorData"); XmlElement creatorData = doc.CreateElement("CreatorData");
creatorData.InnerText = m_ProfileServerURI + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName; creatorData.InnerText = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
sop.AppendChild(creatorData); sop.AppendChild(creatorData);
} }
} }

View File

@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
get { return m_assMapper; } get { return m_assMapper; }
} }
private string m_ProfileServerURI; private string m_HomeURI;
private bool m_OutboundPermission; private bool m_OutboundPermission;
private string m_ThisGatekeeper; private string m_ThisGatekeeper;
@ -84,7 +84,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
if (thisModuleConfig != null) if (thisModuleConfig != null)
{ {
m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); // legacy configuration [obsolete]
m_HomeURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty);
// preferred
m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI);
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty); m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty);
} }
@ -100,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return; return;
base.AddRegion(scene); base.AddRegion(scene);
m_assMapper = new HGAssetMapper(scene, m_ProfileServerURI); m_assMapper = new HGAssetMapper(scene, m_HomeURI);
scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
} }

View File

@ -125,8 +125,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
Dictionary<string, object> options = new Dictionary<string, object>(); Dictionary<string, object> options = new Dictionary<string, object>();
OptionSet ops = new OptionSet(); OptionSet ops = new OptionSet();
// ops.Add("v|version=", delegate(string v) { options["version"] = v; });
ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); // legacy argument [obsolete]
ops.Add("p|profile=", delegate(string v) { Console.WriteLine("\n WARNING: -profile option is obsolete and it will not work. Use -home instead.\n"); });
// preferred
ops.Add("h|home=", delegate(string v) { options["home"] = v; });
ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; }); ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });

View File

@ -394,7 +394,7 @@ namespace OpenSim.Region.Framework.Scenes
private string m_creatorData = string.Empty; private string m_creatorData = string.Empty;
/// <summary> /// <summary>
/// Data about the creator in the form profile_url;name /// Data about the creator in the form home_url;name
/// </summary> /// </summary>
public string CreatorData public string CreatorData
{ {
@ -405,7 +405,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Used by the DB layer to retrieve / store the entire user identification. /// Used by the DB layer to retrieve / store the entire user identification.
/// The identification can either be a simple UUID or a string of the form /// The identification can either be a simple UUID or a string of the form
/// uuid[;profile_url[;name]] /// uuid[;home_url[;name]]
/// </summary> /// </summary>
public string CreatorIdentification public string CreatorIdentification
{ {

View File

@ -1134,12 +1134,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if (sop.CreatorData != null && sop.CreatorData != string.Empty) if (sop.CreatorData != null && sop.CreatorData != string.Empty)
writer.WriteElementString("CreatorData", sop.CreatorData); writer.WriteElementString("CreatorData", sop.CreatorData);
else if (options.ContainsKey("profile")) else if (options.ContainsKey("home"))
{ {
if (m_UserManagement == null) if (m_UserManagement == null)
m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
string name = m_UserManagement.GetUserName(sop.CreatorID); string name = m_UserManagement.GetUserName(sop.CreatorID);
writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name); writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name);
} }
WriteUUID(writer, "FolderID", sop.FolderID, options); WriteUUID(writer, "FolderID", sop.FolderID, options);
@ -1282,12 +1282,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if (item.CreatorData != null && item.CreatorData != string.Empty) if (item.CreatorData != null && item.CreatorData != string.Empty)
writer.WriteElementString("CreatorData", item.CreatorData); writer.WriteElementString("CreatorData", item.CreatorData);
else if (options.ContainsKey("profile")) else if (options.ContainsKey("home"))
{ {
if (m_UserManagement == null) if (m_UserManagement == null)
m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
string name = m_UserManagement.GetUserName(item.CreatorID); string name = m_UserManagement.GetUserName(item.CreatorID);
writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name); writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name);
} }
writer.WriteElementString("Description", item.Description); writer.WriteElementString("Description", item.Description);

View File

@ -53,7 +53,7 @@ namespace OpenSim.Services.HypergridService
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private string m_ProfileServiceURL; private string m_HomeURL;
private IUserAccountService m_UserAccountService; private IUserAccountService m_UserAccountService;
private UserAccountCache m_Cache; private UserAccountCache m_Cache;
@ -74,7 +74,10 @@ namespace OpenSim.Services.HypergridService
if (m_UserAccountService == null) if (m_UserAccountService == null)
throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
m_ProfileServiceURL = assetConfig.GetString("ProfileServerURI", string.Empty); // legacy configuration [obsolete]
m_HomeURL = assetConfig.GetString("ProfileServerURI", string.Empty);
// Preferred
m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL);
m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
} }
@ -134,13 +137,13 @@ namespace OpenSim.Services.HypergridService
UserAccount creator = m_Cache.GetUser(meta.CreatorID); UserAccount creator = m_Cache.GetUser(meta.CreatorID);
if (creator != null) if (creator != null)
meta.CreatorID = m_ProfileServiceURL + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName; meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName;
} }
protected byte[] AdjustIdentifiers(byte[] data) protected byte[] AdjustIdentifiers(byte[] data)
{ {
string xml = Utils.BytesToString(data); string xml = Utils.BytesToString(data);
return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, m_ProfileServiceURL, m_Cache, UUID.Zero)); return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, m_HomeURL, m_Cache, UUID.Zero));
} }
} }

View File

@ -55,7 +55,7 @@ namespace OpenSim.Services.HypergridService
protected new IXInventoryData m_Database; protected new IXInventoryData m_Database;
private string m_ProfileServiceURL; private string m_HomeURL;
private IUserAccountService m_UserAccountService; private IUserAccountService m_UserAccountService;
private UserAccountCache m_Cache; private UserAccountCache m_Cache;
@ -100,7 +100,10 @@ namespace OpenSim.Services.HypergridService
if (m_UserAccountService == null) if (m_UserAccountService == null)
throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
m_ProfileServiceURL = invConfig.GetString("ProfileServerURI", string.Empty); // legacy configuration [obsolete]
m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty);
// Preferred
m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL);
m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
} }
@ -321,7 +324,7 @@ namespace OpenSim.Services.HypergridService
// Adjust the creator data // Adjust the creator data
if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty)) if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty))
it.CreatorData = m_ProfileServiceURL + "/" + it.CreatorId + ";" + user.FirstName + " " + user.LastName; it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName;
return it; return it;
} }

View File

@ -380,7 +380,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; For the InventoryServiceInConnector ; For the InventoryServiceInConnector
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInventoryService" LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInventoryService"
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService" UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
ProfileServerURI = "http://127.0.0.1:8002/user" HomeURI = "http://127.0.0.1:8002"
; * The interface that local users get when they are in other grids. ; * The interface that local users get when they are in other grids.
; * This restricts the access that the rest of the world has to ; * This restricts the access that the rest of the world has to
@ -389,7 +389,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
[HGAssetService] [HGAssetService]
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGAssetService" LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGAssetService"
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService" UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
ProfileServerURI = "http://127.0.0.1:8002/user" HomeURI = "http://127.0.0.1:8002"
[HGFriendsService] [HGFriendsService]
LocalServiceModule = "OpenSim.Services.FriendsService.dll:FriendsService" LocalServiceModule = "OpenSim.Services.FriendsService.dll:FriendsService"

View File

@ -123,7 +123,7 @@
; Change this to your server ; Change this to your server
; accessible from other grids ; accessible from other grids
; ;
ProfileServerURI = "http://mygridserver.com:8002/user" HomeURI = "http://mygridserver.com:8002/user"
Gatekeeper = "http://mygridserver.com:8002" Gatekeeper = "http://mygridserver.com:8002"
;; If you want to protect your assets from being copied by foreign visitors ;; If you want to protect your assets from being copied by foreign visitors
;; uncomment the next line. You may want to do this on sims that have licensed content. ;; uncomment the next line. You may want to do this on sims that have licensed content.

View File

@ -48,13 +48,13 @@
AssetLoaderArgs = "assets/AssetSets.xml" AssetLoaderArgs = "assets/AssetSets.xml"
[HGInventoryService] [HGInventoryService]
ProfileServerURI = "http://127.0.0.1:9000/profiles" HomeURI = "http://127.0.0.1:9000"
[HGAssetService] [HGAssetService]
ProfileServerURI = "http://127.0.0.1:9000/profiles" HomeURI = "http://127.0.0.1:9000"
[HGInventoryAccessModule] [HGInventoryAccessModule]
ProfileServerURI = "http://127.0.0.1:9000/profiles" HomeURI = "http://127.0.0.1:9000"
Gatekeeper = "http://127.0.0.1:9000" Gatekeeper = "http://127.0.0.1:9000"
;; If you want to protect your assets from being copied by foreign visitors ;; If you want to protect your assets from being copied by foreign visitors