diff options
author | Melanie Thielker | 2016-06-15 16:51:02 +0200 |
---|---|---|
committer | Melanie Thielker | 2016-06-15 16:51:02 +0200 |
commit | f800f5ba57a6816afe000b8acf15b25d1bd6bb6b (patch) | |
tree | 85c914bfe2d0a595856284b0461e0eeda1cfa2bf /OpenSim/Region/CoreModules/Framework | |
parent | Fields should be protected unless private is required (diff) | |
download | opensim-SC_OLD-f800f5ba57a6816afe000b8acf15b25d1bd6bb6b.zip opensim-SC_OLD-f800f5ba57a6816afe000b8acf15b25d1bd6bb6b.tar.gz opensim-SC_OLD-f800f5ba57a6816afe000b8acf15b25d1bd6bb6b.tar.bz2 opensim-SC_OLD-f800f5ba57a6816afe000b8acf15b25d1bd6bb6b.tar.xz |
Make the UserManagementModule inheritable
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index e1764bf..b72593c 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
66 | 66 | ||
67 | #region ISharedRegionModule | 67 | #region ISharedRegionModule |
68 | 68 | ||
69 | public void Initialise(IConfigSource config) | 69 | public virtual void Initialise(IConfigSource config) |
70 | { | 70 | { |
71 | string umanmod = config.Configs["Modules"].GetString("UserManagementModule", Name); | 71 | string umanmod = config.Configs["Modules"].GetString("UserManagementModule", Name); |
72 | if (umanmod == Name) | 72 | if (umanmod == Name) |
@@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
88 | m_DisplayChangingHomeURI = userManagementConfig.GetBoolean("DisplayChangingHomeURI", false); | 88 | m_DisplayChangingHomeURI = userManagementConfig.GetBoolean("DisplayChangingHomeURI", false); |
89 | } | 89 | } |
90 | 90 | ||
91 | public bool IsSharedModule | 91 | public virtual bool IsSharedModule |
92 | { | 92 | { |
93 | get { return true; } | 93 | get { return true; } |
94 | } | 94 | } |
@@ -98,12 +98,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
98 | get { return "BasicUserManagementModule"; } | 98 | get { return "BasicUserManagementModule"; } |
99 | } | 99 | } |
100 | 100 | ||
101 | public Type ReplaceableInterface | 101 | public virtual Type ReplaceableInterface |
102 | { | 102 | { |
103 | get { return null; } | 103 | get { return null; } |
104 | } | 104 | } |
105 | 105 | ||
106 | public void AddRegion(Scene scene) | 106 | public virtual void AddRegion(Scene scene) |
107 | { | 107 | { |
108 | if (m_Enabled) | 108 | if (m_Enabled) |
109 | { | 109 | { |
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | public void RemoveRegion(Scene scene) | 122 | public virtual void RemoveRegion(Scene scene) |
123 | { | 123 | { |
124 | if (m_Enabled) | 124 | if (m_Enabled) |
125 | { | 125 | { |
@@ -131,17 +131,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | public void RegionLoaded(Scene s) | 134 | public virtual void RegionLoaded(Scene s) |
135 | { | 135 | { |
136 | if (m_Enabled && m_ServiceThrottle == null) | 136 | if (m_Enabled && m_ServiceThrottle == null) |
137 | m_ServiceThrottle = s.RequestModuleInterface<IServiceThrottleModule>(); | 137 | m_ServiceThrottle = s.RequestModuleInterface<IServiceThrottleModule>(); |
138 | } | 138 | } |
139 | 139 | ||
140 | public void PostInitialise() | 140 | public virtual void PostInitialise() |
141 | { | 141 | { |
142 | } | 142 | } |
143 | 143 | ||
144 | public void Close() | 144 | public virtual void Close() |
145 | { | 145 | { |
146 | lock (m_Scenes) | 146 | lock (m_Scenes) |
147 | { | 147 | { |
@@ -157,27 +157,27 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
157 | 157 | ||
158 | #region Event Handlers | 158 | #region Event Handlers |
159 | 159 | ||
160 | void EventManager_OnPrimsLoaded(Scene s) | 160 | protected virtual void EventManager_OnPrimsLoaded(Scene s) |
161 | { | 161 | { |
162 | // let's sniff all the user names referenced by objects in the scene | 162 | // let's sniff all the user names referenced by objects in the scene |
163 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Caching creators' data from {0} ({1} objects)...", s.RegionInfo.RegionName, s.GetEntities().Length); | 163 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Caching creators' data from {0} ({1} objects)...", s.RegionInfo.RegionName, s.GetEntities().Length); |
164 | s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); }); | 164 | s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); }); |
165 | } | 165 | } |
166 | 166 | ||
167 | void EventManager_OnNewClient(IClientAPI client) | 167 | protected virtual void EventManager_OnNewClient(IClientAPI client) |
168 | { | 168 | { |
169 | client.OnConnectionClosed += new Action<IClientAPI>(HandleConnectionClosed); | 169 | client.OnConnectionClosed += new Action<IClientAPI>(HandleConnectionClosed); |
170 | client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); | 170 | client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); |
171 | client.OnAvatarPickerRequest += new AvatarPickerRequest(HandleAvatarPickerRequest); | 171 | client.OnAvatarPickerRequest += new AvatarPickerRequest(HandleAvatarPickerRequest); |
172 | } | 172 | } |
173 | 173 | ||
174 | void HandleConnectionClosed(IClientAPI client) | 174 | protected virtual void HandleConnectionClosed(IClientAPI client) |
175 | { | 175 | { |
176 | client.OnNameFromUUIDRequest -= new UUIDNameRequest(HandleUUIDNameRequest); | 176 | client.OnNameFromUUIDRequest -= new UUIDNameRequest(HandleUUIDNameRequest); |
177 | client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest); | 177 | client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest); |
178 | } | 178 | } |
179 | 179 | ||
180 | void HandleUUIDNameRequest(UUID uuid, IClientAPI client) | 180 | protected virtual void HandleUUIDNameRequest(UUID uuid, IClientAPI client) |
181 | { | 181 | { |
182 | // m_log.DebugFormat( | 182 | // m_log.DebugFormat( |
183 | // "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}", | 183 | // "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}", |
@@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | public void HandleAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) | 231 | public virtual void HandleAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) |
232 | { | 232 | { |
233 | //EventManager.TriggerAvatarPickerRequest(); | 233 | //EventManager.TriggerAvatarPickerRequest(); |
234 | 234 | ||
@@ -288,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
288 | 288 | ||
289 | #region IPeople | 289 | #region IPeople |
290 | 290 | ||
291 | public List<UserData> GetUserData(string query, int page_size, int page_number) | 291 | public virtual List<UserData> GetUserData(string query, int page_size, int page_number) |
292 | { | 292 | { |
293 | if(m_Scenes.Count <= 0) | 293 | if(m_Scenes.Count <= 0) |
294 | return new List<UserData>();; | 294 | return new List<UserData>();; |
@@ -328,7 +328,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
328 | 328 | ||
329 | #endregion IPeople | 329 | #endregion IPeople |
330 | 330 | ||
331 | private void CacheCreators(SceneObjectGroup sog) | 331 | protected virtual void CacheCreators(SceneObjectGroup sog) |
332 | { | 332 | { |
333 | //m_log.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification); | 333 | //m_log.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification); |
334 | AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData); | 334 | AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData); |
@@ -347,7 +347,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
347 | /// <param name="uuid"></param> | 347 | /// <param name="uuid"></param> |
348 | /// <param name="names">Caller please provide a properly instantiated array for names, string[2]</param> | 348 | /// <param name="names">Caller please provide a properly instantiated array for names, string[2]</param> |
349 | /// <returns></returns> | 349 | /// <returns></returns> |
350 | private bool TryGetUserNames(UUID uuid, string[] names) | 350 | protected virtual bool TryGetUserNames(UUID uuid, string[] names) |
351 | { | 351 | { |
352 | if (names == null) | 352 | if (names == null) |
353 | names = new string[2]; | 353 | names = new string[2]; |
@@ -361,7 +361,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
361 | return false; | 361 | return false; |
362 | } | 362 | } |
363 | 363 | ||
364 | private bool TryGetUserNamesFromCache(UUID uuid, string[] names) | 364 | protected virtual bool TryGetUserNamesFromCache(UUID uuid, string[] names) |
365 | { | 365 | { |
366 | lock (m_UserCache) | 366 | lock (m_UserCache) |
367 | { | 367 | { |
@@ -383,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
383 | /// <returns>True if the name was found, false if not.</returns> | 383 | /// <returns>True if the name was found, false if not.</returns> |
384 | /// <param name='uuid'></param> | 384 | /// <param name='uuid'></param> |
385 | /// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param> | 385 | /// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param> |
386 | private bool TryGetUserNamesFromServices(UUID uuid, string[] names) | 386 | protected virtual bool TryGetUserNamesFromServices(UUID uuid, string[] names) |
387 | { | 387 | { |
388 | if(m_Scenes.Count <= 0) | 388 | if(m_Scenes.Count <= 0) |
389 | return false; | 389 | return false; |
@@ -442,7 +442,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
442 | 442 | ||
443 | #region IUserManagement | 443 | #region IUserManagement |
444 | 444 | ||
445 | public UUID GetUserIdByName(string name) | 445 | public virtual UUID GetUserIdByName(string name) |
446 | { | 446 | { |
447 | string[] parts = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); | 447 | string[] parts = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); |
448 | if (parts.Length < 2) | 448 | if (parts.Length < 2) |
@@ -451,7 +451,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
451 | return GetUserIdByName(parts[0], parts[1]); | 451 | return GetUserIdByName(parts[0], parts[1]); |
452 | } | 452 | } |
453 | 453 | ||
454 | public UUID GetUserIdByName(string firstName, string lastName) | 454 | public virtual UUID GetUserIdByName(string firstName, string lastName) |
455 | { | 455 | { |
456 | if(m_Scenes.Count <= 0) | 456 | if(m_Scenes.Count <= 0) |
457 | return UUID.Zero; | 457 | return UUID.Zero; |
@@ -474,14 +474,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
474 | return UUID.Zero; | 474 | return UUID.Zero; |
475 | } | 475 | } |
476 | 476 | ||
477 | public string GetUserName(UUID uuid) | 477 | public virtual string GetUserName(UUID uuid) |
478 | { | 478 | { |
479 | UserData user; | 479 | UserData user; |
480 | GetUser(uuid, out user); | 480 | GetUser(uuid, out user); |
481 | return user.FirstName + " " + user.LastName; | 481 | return user.FirstName + " " + user.LastName; |
482 | } | 482 | } |
483 | 483 | ||
484 | public string GetUserHomeURL(UUID userID) | 484 | public virtual string GetUserHomeURL(UUID userID) |
485 | { | 485 | { |
486 | UserData user; | 486 | UserData user; |
487 | if(GetUser(userID, out user)) | 487 | if(GetUser(userID, out user)) |
@@ -491,7 +491,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
491 | return string.Empty; | 491 | return string.Empty; |
492 | } | 492 | } |
493 | 493 | ||
494 | public string GetUserServerURL(UUID userID, string serverType) | 494 | public virtual string GetUserServerURL(UUID userID, string serverType) |
495 | { | 495 | { |
496 | UserData userdata; | 496 | UserData userdata; |
497 | if(!GetUser(userID, out userdata)) | 497 | if(!GetUser(userID, out userdata)) |
@@ -531,14 +531,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
531 | return string.Empty; | 531 | return string.Empty; |
532 | } | 532 | } |
533 | 533 | ||
534 | public string GetUserUUI(UUID userID) | 534 | public virtual string GetUserUUI(UUID userID) |
535 | { | 535 | { |
536 | string uui; | 536 | string uui; |
537 | GetUserUUI(userID, out uui); | 537 | GetUserUUI(userID, out uui); |
538 | return uui; | 538 | return uui; |
539 | } | 539 | } |
540 | 540 | ||
541 | public bool GetUserUUI(UUID userID, out string uui) | 541 | public virtual bool GetUserUUI(UUID userID, out string uui) |
542 | { | 542 | { |
543 | UserData ud; | 543 | UserData ud; |
544 | bool result = GetUser(userID, out ud); | 544 | bool result = GetUser(userID, out ud); |
@@ -564,7 +564,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
564 | } | 564 | } |
565 | 565 | ||
566 | #region Cache Management | 566 | #region Cache Management |
567 | public bool GetUser(UUID uuid, out UserData userdata) | 567 | public virtual bool GetUser(UUID uuid, out UserData userdata) |
568 | { | 568 | { |
569 | if(m_Scenes.Count <= 0) | 569 | if(m_Scenes.Count <= 0) |
570 | { | 570 | { |
@@ -657,7 +657,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
657 | return !userdata.IsUnknownUser; | 657 | return !userdata.IsUnknownUser; |
658 | } | 658 | } |
659 | 659 | ||
660 | public void AddUser(UUID uuid, string first, string last) | 660 | public virtual void AddUser(UUID uuid, string first, string last) |
661 | { | 661 | { |
662 | lock(m_UserCache) | 662 | lock(m_UserCache) |
663 | { | 663 | { |
@@ -674,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
674 | } | 674 | } |
675 | } | 675 | } |
676 | 676 | ||
677 | public void AddUser(UUID uuid, string first, string last, string homeURL) | 677 | public virtual void AddUser(UUID uuid, string first, string last, string homeURL) |
678 | { | 678 | { |
679 | //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL); | 679 | //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL); |
680 | 680 | ||
@@ -724,7 +724,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
724 | } | 724 | } |
725 | } | 725 | } |
726 | 726 | ||
727 | public void AddUser(UUID id, string creatorData) | 727 | public virtual void AddUser(UUID id, string creatorData) |
728 | { | 728 | { |
729 | // m_log.InfoFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); | 729 | // m_log.InfoFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); |
730 | 730 | ||
@@ -807,7 +807,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
807 | } | 807 | } |
808 | #endregion | 808 | #endregion |
809 | 809 | ||
810 | public bool IsLocalGridUser(UUID uuid) | 810 | public virtual bool IsLocalGridUser(UUID uuid) |
811 | { | 811 | { |
812 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); | 812 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); |
813 | if (account == null || (account != null && !account.LocalToGrid)) | 813 | if (account == null || (account != null && !account.LocalToGrid)) |
@@ -818,13 +818,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
818 | 818 | ||
819 | #endregion IUserManagement | 819 | #endregion IUserManagement |
820 | 820 | ||
821 | protected void Init() | 821 | protected virtual void Init() |
822 | { | 822 | { |
823 | AddUser(UUID.Zero, "Unknown", "User"); | 823 | AddUser(UUID.Zero, "Unknown", "User"); |
824 | RegisterConsoleCmds(); | 824 | RegisterConsoleCmds(); |
825 | } | 825 | } |
826 | 826 | ||
827 | protected void RegisterConsoleCmds() | 827 | protected virtual void RegisterConsoleCmds() |
828 | { | 828 | { |
829 | MainConsole.Instance.Commands.AddCommand("Users", true, | 829 | MainConsole.Instance.Commands.AddCommand("Users", true, |
830 | "show name", | 830 | "show name", |
@@ -848,7 +848,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
848 | HandleResetUserCache); | 848 | HandleResetUserCache); |
849 | } | 849 | } |
850 | 850 | ||
851 | private void HandleResetUserCache(string module, string[] cmd) | 851 | protected virtual void HandleResetUserCache(string module, string[] cmd) |
852 | { | 852 | { |
853 | lock(m_UserCache) | 853 | lock(m_UserCache) |
854 | { | 854 | { |
@@ -856,7 +856,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
856 | } | 856 | } |
857 | } | 857 | } |
858 | 858 | ||
859 | private void HandleShowUser(string module, string[] cmd) | 859 | protected virtual void HandleShowUser(string module, string[] cmd) |
860 | { | 860 | { |
861 | if (cmd.Length < 3) | 861 | if (cmd.Length < 3) |
862 | { | 862 | { |
@@ -885,7 +885,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
885 | MainConsole.Instance.Output(cdt.ToString()); | 885 | MainConsole.Instance.Output(cdt.ToString()); |
886 | } | 886 | } |
887 | 887 | ||
888 | private void HandleShowUsers(string module, string[] cmd) | 888 | protected virtual void HandleShowUsers(string module, string[] cmd) |
889 | { | 889 | { |
890 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | 890 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); |
891 | cdt.AddColumn("UUID", 36); | 891 | cdt.AddColumn("UUID", 36); |