IUserService.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using OpenMetaverse;
  30. using OpenSim.Services.Interfaces;
  31. namespace OpenSim.Framework.Communications
  32. {
  33. public interface IUserService
  34. {
  35. /// <summary>
  36. /// Add a temporary user profile.
  37. /// </summary>
  38. /// A temporary user profile is one that should exist only for the lifetime of the process.
  39. /// <param name="userProfile"></param>
  40. void AddTemporaryUserProfile(UserProfileData userProfile);
  41. /// <summary>
  42. /// Loads a user profile by name
  43. /// </summary>
  44. /// <param name="firstName">First name</param>
  45. /// <param name="lastName">Last name</param>
  46. /// <returns>A user profile. Returns null if no profile is found</returns>
  47. UserProfileData GetUserProfile(string firstName, string lastName);
  48. /// <summary>
  49. /// Loads a user profile from a database by UUID
  50. /// </summary>
  51. /// <param name="userId">The target UUID</param>
  52. /// <returns>A user profile. Returns null if no user profile is found.</returns>
  53. UserProfileData GetUserProfile(UUID userId);
  54. UserProfileData GetUserProfile(Uri uri);
  55. Uri GetUserUri(UserProfileData userProfile);
  56. UserAgentData GetAgentByUUID(UUID userId);
  57. void ClearUserAgent(UUID avatarID);
  58. List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID QueryID, string Query);
  59. UserProfileData SetupMasterUser(string firstName, string lastName);
  60. UserProfileData SetupMasterUser(string firstName, string lastName, string password);
  61. UserProfileData SetupMasterUser(UUID userId);
  62. /// <summary>
  63. /// Update the user's profile.
  64. /// </summary>
  65. /// <param name="data">UserProfileData object with updated data. Should be obtained
  66. /// via a call to GetUserProfile().</param>
  67. /// <returns>true if the update could be applied, false if it could not be applied.</returns>
  68. bool UpdateUserProfile(UserProfileData data);
  69. /// <summary>
  70. /// Adds a new friend to the database for XUser
  71. /// </summary>
  72. /// <param name="friendlistowner">The agent that who's friends list is being added to</param>
  73. /// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
  74. /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
  75. void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
  76. /// <summary>
  77. /// Delete friend on friendlistowner's friendlist.
  78. /// </summary>
  79. /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
  80. /// <param name="friend">The Ex-friend agent</param>
  81. void RemoveUserFriend(UUID friendlistowner, UUID friend);
  82. /// <summary>
  83. /// Update permissions for friend on friendlistowner's friendlist.
  84. /// </summary>
  85. /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
  86. /// <param name="friend">The agent that is getting or loosing permissions</param>
  87. /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
  88. void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
  89. /// <summary>
  90. /// Logs off a user on the user server
  91. /// </summary>
  92. /// <param name="userid">UUID of the user</param>
  93. /// <param name="regionid">UUID of the Region</param>
  94. /// <param name="regionhandle">regionhandle</param>
  95. /// <param name="position">final position</param>
  96. /// <param name="lookat">final lookat</param>
  97. void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat);
  98. /// <summary>
  99. /// Logs off a user on the user server (deprecated as of 2008-08-27)
  100. /// </summary>
  101. /// <param name="userid">UUID of the user</param>
  102. /// <param name="regionid">UUID of the Region</param>
  103. /// <param name="regionhandle">regionhandle</param>
  104. /// <param name="posx">final position x</param>
  105. /// <param name="posy">final position y</param>
  106. /// <param name="posz">final position z</param>
  107. void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz);
  108. /// <summary>
  109. /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship
  110. /// for UUID friendslistowner
  111. /// </summary>
  112. ///
  113. /// <param name="friendlistowner">The agent for whom we're retreiving the friends Data.</param>
  114. /// <returns>
  115. /// A List of FriendListItems that contains info about the user's friends.
  116. /// Always returns a list even if the user has no friends
  117. /// </returns>
  118. List<FriendListItem> GetUserFriendList(UUID friendlistowner);
  119. // This probably shouldn't be here, it belongs to IAuthentication
  120. // But since Scenes only have IUserService references, I'm placing it here for now.
  121. bool VerifySession(UUID userID, UUID sessionID);
  122. /// <summary>
  123. /// Authenticate a user by their password.
  124. /// </summary>
  125. ///
  126. /// This is used by callers outside the login process that want to
  127. /// verify a user who has given their password.
  128. ///
  129. /// This should probably also be in IAuthentication but is here for the same reasons as VerifySession() is
  130. ///
  131. /// <param name="userID"></param>
  132. /// <param name="password"></param>
  133. /// <returns></returns>
  134. bool AuthenticateUserByPassword(UUID userID, string password);
  135. // Temporary Hack until we move everything to the new service model
  136. void SetInventoryService(IInventoryService invService);
  137. }
  138. }