diff options
author | Justin Clarke Casey | 2008-11-28 15:34:30 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-28 15:34:30 +0000 |
commit | 0862627b341641ec0223bb4191dfee8d85724c9e (patch) | |
tree | ef1815b067c345aa92a81375f12137a3e47876f3 /OpenSim/Framework/Communications | |
parent | * Changed name of auth function to better reflect actual use (diff) | |
download | opensim-SC_OLD-0862627b341641ec0223bb4191dfee8d85724c9e.zip opensim-SC_OLD-0862627b341641ec0223bb4191dfee8d85724c9e.tar.gz opensim-SC_OLD-0862627b341641ec0223bb4191dfee8d85724c9e.tar.bz2 opensim-SC_OLD-0862627b341641ec0223bb4191dfee8d85724c9e.tar.xz |
* refactor: move CreateUser into UserServiceAdmin
Diffstat (limited to 'OpenSim/Framework/Communications')
4 files changed, 66 insertions, 96 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index bcf9bed..a5ead3f 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -106,8 +106,12 @@ namespace OpenSim.Framework.Communications | |||
106 | protected NetworkServersInfo m_networkServersInfo; | 106 | protected NetworkServersInfo m_networkServersInfo; |
107 | 107 | ||
108 | /// <summary> | 108 | /// <summary> |
109 | /// Interface to administrative user service calls. | 109 | /// Interface to user service for administrating users. |
110 | /// </summary> | 110 | /// </summary> |
111 | public IUserServiceAdmin UserServiceAdmin | ||
112 | { | ||
113 | get { return m_userServiceAdmin; } | ||
114 | } | ||
111 | protected IUserServiceAdmin m_userServiceAdmin; | 115 | protected IUserServiceAdmin m_userServiceAdmin; |
112 | 116 | ||
113 | public BaseHttpServer HttpServer | 117 | public BaseHttpServer HttpServer |
@@ -247,63 +251,6 @@ namespace OpenSim.Framework.Communications | |||
247 | } | 251 | } |
248 | 252 | ||
249 | #endregion | 253 | #endregion |
250 | |||
251 | /// <summary> | ||
252 | /// Persistently adds a user to OpenSim. | ||
253 | /// </summary> | ||
254 | /// <param name="firstName"></param> | ||
255 | /// <param name="lastName"></param> | ||
256 | /// <param name="password"></param> | ||
257 | /// <param name="email"></param> | ||
258 | /// <param name="regX"></param> | ||
259 | /// <param name="regY"></param> | ||
260 | /// <returns>The UUID of the added user. Returns UUID.Zero if the add was unsuccessful</returns> | ||
261 | public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY) | ||
262 | { | ||
263 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); | ||
264 | |||
265 | m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY); | ||
266 | UserProfileData userProf = UserService.GetUserProfile(firstName, lastName); | ||
267 | if (userProf == null) | ||
268 | { | ||
269 | return UUID.Zero; | ||
270 | } | ||
271 | else | ||
272 | { | ||
273 | InterServiceInventoryService.CreateNewUserInventory(userProf.ID); | ||
274 | m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName); | ||
275 | return userProf.ID; | ||
276 | } | ||
277 | } | ||
278 | |||
279 | /// <summary> | ||
280 | /// Adds the user. | ||
281 | /// </summary> | ||
282 | /// <param name="firstName">The first name.</param> | ||
283 | /// <param name="lastName">The last name.</param> | ||
284 | /// <param name="password">The password.</param> | ||
285 | /// <param name="email">The email.</param> | ||
286 | /// <param name="regX">The reg X.</param> | ||
287 | /// <param name="regY">The reg Y.</param> | ||
288 | /// <param name="SetUUID">The set UUID.</param> | ||
289 | /// <returns></returns> | ||
290 | public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID) | ||
291 | { | ||
292 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); | ||
293 | |||
294 | m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY, SetUUID); | ||
295 | UserProfileData userProf = UserService.GetUserProfile(firstName, lastName); | ||
296 | if (userProf == null) | ||
297 | { | ||
298 | return UUID.Zero; | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | InterServiceInventoryService.CreateNewUserInventory(userProf.ID); | ||
303 | m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName); | ||
304 | return userProf.ID; | ||
305 | } | ||
306 | } | ||
307 | 254 | ||
308 | /// <summary> | 255 | /// <summary> |
309 | /// Reset a user password | 256 | /// Reset a user password |
diff --git a/OpenSim/Framework/Communications/IUserServiceAdmin.cs b/OpenSim/Framework/Communications/IUserServiceAdmin.cs index a120add..b1f974b 100644 --- a/OpenSim/Framework/Communications/IUserServiceAdmin.cs +++ b/OpenSim/Framework/Communications/IUserServiceAdmin.cs | |||
@@ -32,29 +32,29 @@ namespace OpenSim.Framework.Communications | |||
32 | public interface IUserServiceAdmin | 32 | public interface IUserServiceAdmin |
33 | { | 33 | { |
34 | /// <summary> | 34 | /// <summary> |
35 | /// Add a new user profile | 35 | /// Add a new user |
36 | /// </summary> | 36 | /// </summary> |
37 | /// <param name="firstName">The first name.</param> | 37 | /// <param name="firstName">The first name</param> |
38 | /// <param name="lastName">The last name.</param> | 38 | /// <param name="lastName">The last name</param> |
39 | /// <param name="pass">password of avatar</param> | 39 | /// <param name="pass">password of avatar</param> |
40 | /// <param name="email">email of user</param> | 40 | /// <param name="email">email of user</param> |
41 | /// <param name="regX">region X.</param> | 41 | /// <param name="regX">region X</param> |
42 | /// <param name="regY">region Y.</param> | 42 | /// <param name="regY">region Y</param> |
43 | /// <returns></returns> | 43 | /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns> |
44 | UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY); | 44 | UUID AddUser(string firstName, string lastName, string pass, string email, uint regX, uint regY); |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances! | 47 | /// Add a new user with a specified UUID. SHOULD ONLY BE USED in very special circumstances from modules! |
48 | /// </summary> | 48 | /// </summary> |
49 | /// <param name="firstName">The first name.</param> | 49 | /// <param name="firstName">The first name</param> |
50 | /// <param name="lastName">The last name.</param> | 50 | /// <param name="lastName">The last name</param> |
51 | /// <param name="pass">password of avatar</param> | 51 | /// <param name="pass">password of avatar</param> |
52 | /// <param name="email">email of user</param> | 52 | /// <param name="email">email of user</param> |
53 | /// <param name="regX">region X.</param> | 53 | /// <param name="regX">region X</param> |
54 | /// <param name="regY">region Y.</param> | 54 | /// <param name="regY">region Y</param> |
55 | /// <param name="setUUID">The set UUID.</param> | 55 | /// <param name="setUUID">The set UUID</param> |
56 | /// <returns></returns> | 56 | /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns> |
57 | UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID setUUID); | 57 | UUID AddUser(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID setUUID); |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Reset a user password | 60 | /// Reset a user password |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 777e15b..7a44420 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -82,7 +82,6 @@ namespace OpenSim.Framework.Communications | |||
82 | get { return "default"; } | 82 | get { return "default"; } |
83 | } | 83 | } |
84 | 84 | ||
85 | // See IInventoryServices | ||
86 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 85 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) |
87 | { | 86 | { |
88 | // m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); | 87 | // m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index a5ca654..3946ea3 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -52,6 +52,17 @@ namespace OpenSim.Framework.Communications | |||
52 | /// List of plugins to search for user data | 52 | /// List of plugins to search for user data |
53 | /// </value> | 53 | /// </value> |
54 | private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>(); | 54 | private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>(); |
55 | |||
56 | private IInterServiceInventoryServices m_interServiceInventoryService; | ||
57 | |||
58 | /// <summary> | ||
59 | /// Constructor | ||
60 | /// </summary> | ||
61 | /// <param name="interServiceInventoryService"></param> | ||
62 | public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService) | ||
63 | { | ||
64 | m_interServiceInventoryService = interServiceInventoryService; | ||
65 | } | ||
55 | 66 | ||
56 | /// <summary> | 67 | /// <summary> |
57 | /// Add a new user data plugin - plugins will be requested in the order they were added. | 68 | /// Add a new user data plugin - plugins will be requested in the order they were added. |
@@ -80,7 +91,7 @@ namespace OpenSim.Framework.Communications | |||
80 | _plugins.AddRange(loader.Plugins); | 91 | _plugins.AddRange(loader.Plugins); |
81 | } | 92 | } |
82 | 93 | ||
83 | #region Get UserProfile | 94 | #region Get UserProfile |
84 | 95 | ||
85 | // see IUserService | 96 | // see IUserService |
86 | public UserProfileData GetUserProfile(string fname, string lname) | 97 | public UserProfileData GetUserProfile(string fname, string lname) |
@@ -586,39 +597,42 @@ namespace OpenSim.Framework.Communications | |||
586 | #endregion | 597 | #endregion |
587 | 598 | ||
588 | /// <summary> | 599 | /// <summary> |
589 | /// Add a new user profile | 600 | /// Add a new user |
590 | /// </summary> | 601 | /// </summary> |
591 | /// <param name="firstName">first name.</param> | 602 | /// <param name="firstName">first name</param> |
592 | /// <param name="lastName">last name.</param> | 603 | /// <param name="lastName">last name</param> |
593 | /// <param name="pass">password</param> | 604 | /// <param name="password">password</param> |
594 | /// <param name="email">email.</param> | 605 | /// <param name="email">email</param> |
595 | /// <param name="regX">location X.</param> | 606 | /// <param name="regX">location X</param> |
596 | /// <param name="regY">location Y.</param> | 607 | /// <param name="regY">location Y</param> |
597 | /// <returns></returns> | 608 | /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns> |
598 | public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY) | 609 | public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY) |
599 | { | 610 | { |
600 | return AddUserProfile(firstName, lastName, pass, email, regX, regY, UUID.Random()); | 611 | return AddUser(firstName, lastName, password, email, regX, regY, UUID.Random()); |
601 | } | 612 | } |
602 | 613 | ||
603 | /// <summary> | 614 | /// <summary> |
604 | /// Adds the user profile. | 615 | /// Add a new user |
605 | /// </summary> | 616 | /// </summary> |
606 | /// <param name="firstName">first name.</param> | 617 | /// <param name="firstName">first name</param> |
607 | /// <param name="lastName">last name.</param> | 618 | /// <param name="lastName">last name</param> |
608 | /// <param name="pass">password</param> | 619 | /// <param name="password">password</param> |
609 | /// <param name="email">email.</param> | 620 | /// <param name="email">email</param> |
610 | /// <param name="regX">location X.</param> | 621 | /// <param name="regX">location X</param> |
611 | /// <param name="regY">location Y.</param> | 622 | /// <param name="regY">location Y</param> |
612 | /// <param name="SetUUID">UUID of avatar.</param> | 623 | /// <param name="SetUUID">UUID of avatar.</param> |
613 | /// <returns></returns> | 624 | /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns> |
614 | public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID SetUUID) | 625 | public UUID AddUser( |
626 | string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID) | ||
615 | { | 627 | { |
628 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); | ||
629 | |||
616 | UserProfileData user = new UserProfileData(); | 630 | UserProfileData user = new UserProfileData(); |
617 | user.HomeLocation = new Vector3(128, 128, 100); | 631 | user.HomeLocation = new Vector3(128, 128, 100); |
618 | user.ID = SetUUID; | 632 | user.ID = SetUUID; |
619 | user.FirstName = firstName; | 633 | user.FirstName = firstName; |
620 | user.SurName = lastName; | 634 | user.SurName = lastName; |
621 | user.PasswordHash = pass; | 635 | user.PasswordHash = md5PasswdHash; |
622 | user.PasswordSalt = String.Empty; | 636 | user.PasswordSalt = String.Empty; |
623 | user.Created = Util.UnixTimeSinceEpoch(); | 637 | user.Created = Util.UnixTimeSinceEpoch(); |
624 | user.HomeLookAt = new Vector3(100, 100, 100); | 638 | user.HomeLookAt = new Vector3(100, 100, 100); |
@@ -638,7 +652,17 @@ namespace OpenSim.Framework.Communications | |||
638 | } | 652 | } |
639 | } | 653 | } |
640 | 654 | ||
641 | return user.ID; | 655 | UserProfileData userProf = GetUserProfile(firstName, lastName); |
656 | if (userProf == null) | ||
657 | { | ||
658 | return UUID.Zero; | ||
659 | } | ||
660 | else | ||
661 | { | ||
662 | m_interServiceInventoryService.CreateNewUserInventory(userProf.ID); | ||
663 | |||
664 | return userProf.ID; | ||
665 | } | ||
642 | } | 666 | } |
643 | 667 | ||
644 | /// <summary> | 668 | /// <summary> |