From f800f5ba57a6816afe000b8acf15b25d1bd6bb6b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 15 Jun 2016 16:51:02 +0200 Subject: Make the UserManagementModule inheritable --- .../UserManagement/UserManagementModule.cs | 70 +++++++++++----------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'OpenSim') 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 #region ISharedRegionModule - public void Initialise(IConfigSource config) + public virtual void Initialise(IConfigSource config) { string umanmod = config.Configs["Modules"].GetString("UserManagementModule", Name); if (umanmod == Name) @@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement m_DisplayChangingHomeURI = userManagementConfig.GetBoolean("DisplayChangingHomeURI", false); } - public bool IsSharedModule + public virtual bool IsSharedModule { get { return true; } } @@ -98,12 +98,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement get { return "BasicUserManagementModule"; } } - public Type ReplaceableInterface + public virtual Type ReplaceableInterface { get { return null; } } - public void AddRegion(Scene scene) + public virtual void AddRegion(Scene scene) { if (m_Enabled) { @@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - public void RemoveRegion(Scene scene) + public virtual void RemoveRegion(Scene scene) { if (m_Enabled) { @@ -131,17 +131,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - public void RegionLoaded(Scene s) + public virtual void RegionLoaded(Scene s) { if (m_Enabled && m_ServiceThrottle == null) m_ServiceThrottle = s.RequestModuleInterface(); } - public void PostInitialise() + public virtual void PostInitialise() { } - public void Close() + public virtual void Close() { lock (m_Scenes) { @@ -157,27 +157,27 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement #region Event Handlers - void EventManager_OnPrimsLoaded(Scene s) + protected virtual void EventManager_OnPrimsLoaded(Scene s) { // let's sniff all the user names referenced by objects in the scene m_log.DebugFormat("[USER MANAGEMENT MODULE]: Caching creators' data from {0} ({1} objects)...", s.RegionInfo.RegionName, s.GetEntities().Length); s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); }); } - void EventManager_OnNewClient(IClientAPI client) + protected virtual void EventManager_OnNewClient(IClientAPI client) { client.OnConnectionClosed += new Action(HandleConnectionClosed); client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); client.OnAvatarPickerRequest += new AvatarPickerRequest(HandleAvatarPickerRequest); } - void HandleConnectionClosed(IClientAPI client) + protected virtual void HandleConnectionClosed(IClientAPI client) { client.OnNameFromUUIDRequest -= new UUIDNameRequest(HandleUUIDNameRequest); client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest); } - void HandleUUIDNameRequest(UUID uuid, IClientAPI client) + protected virtual void HandleUUIDNameRequest(UUID uuid, IClientAPI client) { // m_log.DebugFormat( // "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}", @@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - public void HandleAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) + public virtual void HandleAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) { //EventManager.TriggerAvatarPickerRequest(); @@ -288,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement #region IPeople - public List GetUserData(string query, int page_size, int page_number) + public virtual List GetUserData(string query, int page_size, int page_number) { if(m_Scenes.Count <= 0) return new List();; @@ -328,7 +328,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement #endregion IPeople - private void CacheCreators(SceneObjectGroup sog) + protected virtual void CacheCreators(SceneObjectGroup sog) { //m_log.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification); AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData); @@ -347,7 +347,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement /// /// Caller please provide a properly instantiated array for names, string[2] /// - private bool TryGetUserNames(UUID uuid, string[] names) + protected virtual bool TryGetUserNames(UUID uuid, string[] names) { if (names == null) names = new string[2]; @@ -361,7 +361,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return false; } - private bool TryGetUserNamesFromCache(UUID uuid, string[] names) + protected virtual bool TryGetUserNamesFromCache(UUID uuid, string[] names) { lock (m_UserCache) { @@ -383,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement /// True if the name was found, false if not. /// /// The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User" - private bool TryGetUserNamesFromServices(UUID uuid, string[] names) + protected virtual bool TryGetUserNamesFromServices(UUID uuid, string[] names) { if(m_Scenes.Count <= 0) return false; @@ -442,7 +442,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement #region IUserManagement - public UUID GetUserIdByName(string name) + public virtual UUID GetUserIdByName(string name) { string[] parts = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 2) @@ -451,7 +451,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return GetUserIdByName(parts[0], parts[1]); } - public UUID GetUserIdByName(string firstName, string lastName) + public virtual UUID GetUserIdByName(string firstName, string lastName) { if(m_Scenes.Count <= 0) return UUID.Zero; @@ -474,14 +474,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return UUID.Zero; } - public string GetUserName(UUID uuid) + public virtual string GetUserName(UUID uuid) { UserData user; GetUser(uuid, out user); return user.FirstName + " " + user.LastName; } - public string GetUserHomeURL(UUID userID) + public virtual string GetUserHomeURL(UUID userID) { UserData user; if(GetUser(userID, out user)) @@ -491,7 +491,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return string.Empty; } - public string GetUserServerURL(UUID userID, string serverType) + public virtual string GetUserServerURL(UUID userID, string serverType) { UserData userdata; if(!GetUser(userID, out userdata)) @@ -531,14 +531,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return string.Empty; } - public string GetUserUUI(UUID userID) + public virtual string GetUserUUI(UUID userID) { string uui; GetUserUUI(userID, out uui); return uui; } - public bool GetUserUUI(UUID userID, out string uui) + public virtual bool GetUserUUI(UUID userID, out string uui) { UserData ud; bool result = GetUser(userID, out ud); @@ -564,7 +564,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } #region Cache Management - public bool GetUser(UUID uuid, out UserData userdata) + public virtual bool GetUser(UUID uuid, out UserData userdata) { if(m_Scenes.Count <= 0) { @@ -657,7 +657,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return !userdata.IsUnknownUser; } - public void AddUser(UUID uuid, string first, string last) + public virtual void AddUser(UUID uuid, string first, string last) { lock(m_UserCache) { @@ -674,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - public void AddUser(UUID uuid, string first, string last, string homeURL) + public virtual void AddUser(UUID uuid, string first, string last, string homeURL) { //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL); @@ -724,7 +724,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - public void AddUser(UUID id, string creatorData) + public virtual void AddUser(UUID id, string creatorData) { // m_log.InfoFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); @@ -807,7 +807,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } #endregion - public bool IsLocalGridUser(UUID uuid) + public virtual bool IsLocalGridUser(UUID uuid) { UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); if (account == null || (account != null && !account.LocalToGrid)) @@ -818,13 +818,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement #endregion IUserManagement - protected void Init() + protected virtual void Init() { AddUser(UUID.Zero, "Unknown", "User"); RegisterConsoleCmds(); } - protected void RegisterConsoleCmds() + protected virtual void RegisterConsoleCmds() { MainConsole.Instance.Commands.AddCommand("Users", true, "show name", @@ -848,7 +848,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement HandleResetUserCache); } - private void HandleResetUserCache(string module, string[] cmd) + protected virtual void HandleResetUserCache(string module, string[] cmd) { lock(m_UserCache) { @@ -856,7 +856,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - private void HandleShowUser(string module, string[] cmd) + protected virtual void HandleShowUser(string module, string[] cmd) { if (cmd.Length < 3) { @@ -885,7 +885,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement MainConsole.Instance.Output(cdt.ToString()); } - private void HandleShowUsers(string module, string[] cmd) + protected virtual void HandleShowUsers(string module, string[] cmd) { ConsoleDisplayTable cdt = new ConsoleDisplayTable(); cdt.AddColumn("UUID", 36); -- cgit v1.1 From d2f61f5320084ea2ee2d557bba24ed221eb18d1e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 16 Jun 2016 01:47:52 +0200 Subject: Also make the HGUserManagementModule more amenable to subclassing. --- .../CoreModules/Framework/UserManagement/HGUserManagementModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs index 7b89c2c..ea3bbe7 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement #region ISharedRegionModule - public new void Initialise(IConfigSource config) + public override void Initialise(IConfigSource config) { string umanmod = config.Configs["Modules"].GetString("UserManagementModule", null); if (umanmod == Name) @@ -172,4 +172,4 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } -} \ No newline at end of file +} -- cgit v1.1