本文整理汇总了C#中IUserAccountService.GetUserAccount方法的典型用法代码示例。如果您正苦于以下问题:C# IUserAccountService.GetUserAccount方法的具体用法?C# IUserAccountService.GetUserAccount怎么用?C# IUserAccountService.GetUserAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUserAccountService
的用法示例。
在下文中一共展示了IUserAccountService.GetUserAccount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeOspa
/// <summary>
/// Make an OSPA given a user UUID
/// </summary>
/// <param name="userId"></param>
/// <param name="commsManager"></param>
/// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
public static string MakeOspa(UUID userId, IUserAccountService userService)
{
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
if (account != null)
return MakeOspa(account.FirstName, account.LastName);
return null;
}
示例2: MakeOspa
/// <summary>
/// Make an OSPA given a user UUID
/// </summary>
/// <param name="userId"></param>
/// <param name="commsManager"></param>
/// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
public static string MakeOspa(UUID userId, IUserAccountService userService)
{
if (userService == null)
{
m_log.Warn("[OSP RESOLVER]: UserService is null");
return userId.ToString();
}
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
if (account != null)
return MakeOspa(account.FirstName, account.LastName);
// else
// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
return null;
}
示例3: RewriteSOP
/// <summary>
/// Takes a XML representation of a SceneObjectPart and returns another XML representation
/// with creator data added to it.
/// </summary>
/// <param name="xml">The SceneObjectPart represented in XML2</param>
/// <param name="profileURL">The URL of the profile service for the creator</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>
/// <returns>The SceneObjectPart represented in XML2</returns>
public static string RewriteSOP(string xml, string profileURL, IUserAccountService userService, UUID scopeID)
{
if (xml == string.Empty || profileURL == string.Empty || userService == null)
return xml;
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
foreach (XmlNode sop in sops)
{
UserAccount creator = null;
bool hasCreatorData = false;
XmlNodeList nodes = sop.ChildNodes;
foreach (XmlNode node in nodes)
{
if (node.Name == "CreatorID")
{
UUID uuid = UUID.Zero;
UUID.TryParse(node.InnerText, out uuid);
creator = userService.GetUserAccount(scopeID, uuid);
}
if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
hasCreatorData = true;
//if (node.Name == "OwnerID")
//{
// UserAccount owner = GetUser(node.InnerText);
// if (owner != null)
// node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName;
//}
}
if (!hasCreatorData && creator != null)
{
XmlElement creatorData = doc.CreateElement("CreatorData");
creatorData.InnerText = profileURL + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName;
sop.AppendChild(creatorData);
}
}
using (StringWriter wr = new StringWriter())
{
doc.Save(wr);
return wr.ToString();
}
}
示例4: ResolveOspaName
/// <summary>
/// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile
/// then a temporary user profile is inserted in the cache.
/// </summary>
/// <param name="name"></param>
/// <param name="commsManager"></param>
/// <returns>
/// An OpenSim internal identifier for the name given. Returns null if the name was not valid
/// </returns>
protected static UUID ResolveOspaName(string name, IUserAccountService userService)
{
if (userService == null)
return UUID.Zero;
int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
if (nameSeparatorIndex < 0)
{
m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
return UUID.Zero;
}
string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName);
if (account != null)
return account.PrincipalID;
// XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
/*
UserProfileData tempUserProfile = new UserProfileData();
tempUserProfile.FirstName = firstName;
tempUserProfile.SurName = lastName;
tempUserProfile.ID = HashName(tempUserProfile.Name);
m_log.DebugFormat(
"[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
return tempUserProfile.ID;
*/
return UUID.Zero;
}
示例5: Serialize
public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
{
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument();
writer.WriteStartElement("InventoryItem");
writer.WriteStartElement("Name");
writer.WriteString(inventoryItem.Name);
writer.WriteEndElement();
writer.WriteStartElement("ID");
writer.WriteString(inventoryItem.ID.ToString());
writer.WriteEndElement();
writer.WriteStartElement("InvType");
writer.WriteString(inventoryItem.InvType.ToString());
writer.WriteEndElement();
writer.WriteStartElement("CreatorUUID");
writer.WriteString(OspResolver.MakeOspa(inventoryItem.CreatorIdAsUuid, userAccountService));
writer.WriteEndElement();
writer.WriteStartElement("CreationDate");
writer.WriteString(inventoryItem.CreationDate.ToString());
writer.WriteEndElement();
writer.WriteStartElement("Owner");
writer.WriteString(inventoryItem.Owner.ToString());
writer.WriteEndElement();
writer.WriteStartElement("Description");
writer.WriteString(inventoryItem.Description);
writer.WriteEndElement();
writer.WriteStartElement("AssetType");
writer.WriteString(inventoryItem.AssetType.ToString());
writer.WriteEndElement();
writer.WriteStartElement("AssetID");
writer.WriteString(inventoryItem.AssetID.ToString());
writer.WriteEndElement();
writer.WriteStartElement("SaleType");
writer.WriteString(inventoryItem.SaleType.ToString());
writer.WriteEndElement();
writer.WriteStartElement("SalePrice");
writer.WriteString(inventoryItem.SalePrice.ToString());
writer.WriteEndElement();
writer.WriteStartElement("BasePermissions");
writer.WriteString(inventoryItem.BasePermissions.ToString());
writer.WriteEndElement();
writer.WriteStartElement("CurrentPermissions");
writer.WriteString(inventoryItem.CurrentPermissions.ToString());
writer.WriteEndElement();
writer.WriteStartElement("EveryOnePermissions");
writer.WriteString(inventoryItem.EveryOnePermissions.ToString());
writer.WriteEndElement();
writer.WriteStartElement("NextPermissions");
writer.WriteString(inventoryItem.NextPermissions.ToString());
writer.WriteEndElement();
writer.WriteStartElement("Flags");
writer.WriteString(inventoryItem.Flags.ToString());
writer.WriteEndElement();
writer.WriteStartElement("GroupID");
writer.WriteString(inventoryItem.GroupID.ToString());
writer.WriteEndElement();
writer.WriteStartElement("GroupOwned");
writer.WriteString(inventoryItem.GroupOwned.ToString());
writer.WriteEndElement();
if (options.ContainsKey("creators") && inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty)
writer.WriteElementString("CreatorData", inventoryItem.CreatorData);
else if (options.ContainsKey("home"))
{
if (userAccountService != null)
{
UserAccount account = userAccountService.GetUserAccount(UUID.Zero, inventoryItem.CreatorIdAsUuid);
if (account != null)
{
writer.WriteElementString("CreatorData", (string)options["home"] + "/" + inventoryItem.CreatorIdAsUuid + ";" + account.FirstName + " " + account.LastName);
}
writer.WriteElementString("CreatorID", inventoryItem.CreatorId);
}
}
writer.WriteEndElement();
writer.Close();
sw.Close();
return sw.ToString();
}
示例6: ResolveOspaName
/// <summary>
/// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile
/// then a temporary user profile is inserted in the cache.
/// </summary>
/// <param name="name"></param>
/// <param name="userService"></param>
/// <returns>
/// An OpenSim internal identifier for the name given. Returns null if the name was not valid
/// </returns>
protected static UUID ResolveOspaName(string name, IUserAccountService userService)
{
if (userService == null)
return UUID.Zero;
int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
if (nameSeparatorIndex < 0)
{
MainConsole.Instance.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
return UUID.Zero;
}
string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
UserAccount account = userService.GetUserAccount(null, firstName, lastName);
if (account != null)
return account.PrincipalID;
return UUID.Zero;
}