diff options
author | Adam Frisby | 2007-06-09 01:21:53 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-09 01:21:53 +0000 |
commit | 26b208d738c1e33140442b27ab71bdac685b4c2c (patch) | |
tree | edf518bc66cc503a04dd864c7356a1fc6eaaedf3 /OpenGridServices/OpenGridServices.UserServer/UserManager.cs | |
parent | *Adding configuration settings for master avatars (diff) | |
download | opensim-SC_OLD-26b208d738c1e33140442b27ab71bdac685b4c2c.zip opensim-SC_OLD-26b208d738c1e33140442b27ab71bdac685b4c2c.tar.gz opensim-SC_OLD-26b208d738c1e33140442b27ab71bdac685b4c2c.tar.bz2 opensim-SC_OLD-26b208d738c1e33140442b27ab71bdac685b4c2c.tar.xz |
* Sugilite user server can now return user profile information by account name (Hi MingChen) - uses the REST GET /user/name/ method.
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices/OpenGridServices.UserServer/UserManager.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGridServices.UserServer/UserManager.cs b/OpenGridServices/OpenGridServices.UserServer/UserManager.cs index 913d0fc..773fa71 100644 --- a/OpenGridServices/OpenGridServices.UserServer/UserManager.cs +++ b/OpenGridServices/OpenGridServices.UserServer/UserManager.cs | |||
@@ -655,5 +655,56 @@ namespace OpenGridServices.UserServer | |||
655 | return "OK"; | 655 | return "OK"; |
656 | } | 656 | } |
657 | 657 | ||
658 | public string CreateUnknownUserErrorResponse() | ||
659 | { | ||
660 | return "<error>Unknown user</error>"; | ||
661 | } | ||
662 | |||
663 | /// <summary> | ||
664 | /// Converts a user profile to an XML element which can be returned | ||
665 | /// </summary> | ||
666 | /// <param name="profile">The user profile</param> | ||
667 | /// <returns>A string containing an XML Document of the user profile</returns> | ||
668 | public string ProfileToXml(UserProfileData profile) | ||
669 | { | ||
670 | System.IO.StringWriter sw = new System.IO.StringWriter(); | ||
671 | XmlTextWriter xw = new XmlTextWriter(sw); | ||
672 | |||
673 | // Header | ||
674 | xw.Formatting = Formatting.Indented; | ||
675 | xw.WriteStartDocument(); | ||
676 | xw.WriteDocType("userprofile", null, null, null); | ||
677 | xw.WriteComment("Found user profiles matching the request"); | ||
678 | xw.WriteStartElement("users"); | ||
679 | |||
680 | // User | ||
681 | xw.WriteStartElement("user"); | ||
682 | xw.WriteAttributeString("firstname", profile.username); | ||
683 | xw.WriteAttributeString("lastname", profile.surname); | ||
684 | xw.WriteAttributeString("uuid", profile.UUID.ToStringHyphenated()); | ||
685 | xw.WriteAttributeString("inventory", profile.userInventoryURI); | ||
686 | xw.WriteAttributeString("asset", profile.userAssetURI); | ||
687 | xw.WriteEndElement(); | ||
688 | |||
689 | // Footer | ||
690 | xw.WriteEndElement(); | ||
691 | xw.Flush(); | ||
692 | xw.Close(); | ||
693 | |||
694 | return sw.ToString(); | ||
695 | } | ||
696 | |||
697 | public string RestGetUserMethodName(string request, string path, string param) | ||
698 | { | ||
699 | UserProfileData userProfile = getUserProfile(param.Trim()); | ||
700 | |||
701 | if (userProfile == null) | ||
702 | { | ||
703 | return CreateUnknownUserErrorResponse(); | ||
704 | } | ||
705 | |||
706 | return ProfileToXml(userProfile); | ||
707 | } | ||
708 | |||
658 | } | 709 | } |
659 | } | 710 | } |