diff options
author | Diva Canto | 2012-03-17 15:36:20 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-17 15:36:20 -0700 |
commit | 7dfa0309c63263fb15dc9e3883f5717f28e21c0c (patch) | |
tree | 38255cfa7087ae5649d998285e7981f55be2d9af /OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs | |
parent | BAD JUSTIN! (diff) | |
download | opensim-SC_OLD-7dfa0309c63263fb15dc9e3883f5717f28e21c0c.zip opensim-SC_OLD-7dfa0309c63263fb15dc9e3883f5717f28e21c0c.tar.gz opensim-SC_OLD-7dfa0309c63263fb15dc9e3883f5717f28e21c0c.tar.bz2 opensim-SC_OLD-7dfa0309c63263fb15dc9e3883f5717f28e21c0c.tar.xz |
More on HG access control. This commit splits the UserManagementModule into the Basic one and the HG one, so that we can do everything that needs to be done for HG ACLs to work without interfering with the vanilla opensim. For the moment, it finds foreign users who have left a trace in the region, e.g. an object. This makes it possible to ban/IM/etc these users using the regular avatar picker. TODO: contact the UAS directly given a name of the form First.Last @foo.com.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs new file mode 100644 index 0000000..6543bf2 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs | |||
@@ -0,0 +1,119 @@ | |||
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 System.IO; | ||
30 | using System.Reflection; | ||
31 | |||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Region.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Services.Connectors.Hypergrid; | ||
39 | |||
40 | using OpenMetaverse; | ||
41 | using OpenMetaverse.Packets; | ||
42 | using log4net; | ||
43 | using Nini.Config; | ||
44 | |||
45 | namespace OpenSim.Region.CoreModules.Framework.UserManagement | ||
46 | { | ||
47 | public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement | ||
48 | { | ||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | |||
52 | #region ISharedRegionModule | ||
53 | |||
54 | public new void Initialise(IConfigSource config) | ||
55 | { | ||
56 | string umanmod = config.Configs["Modules"].GetString("UserManagementModule", base.Name); | ||
57 | if (umanmod == Name) | ||
58 | { | ||
59 | m_Enabled = true; | ||
60 | RegisterConsoleCmds(); | ||
61 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | public override string Name | ||
66 | { | ||
67 | get { return "HGUserManagementModule"; } | ||
68 | } | ||
69 | |||
70 | #endregion ISharedRegionModule | ||
71 | |||
72 | protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users) | ||
73 | { | ||
74 | string[] words = query.Split(new char[] { ' ' }); | ||
75 | |||
76 | for (int i = 0; i < words.Length; i++) | ||
77 | { | ||
78 | if (words[i].Length < 3) | ||
79 | { | ||
80 | if (i != words.Length - 1) | ||
81 | Array.Copy(words, i + 1, words, i, words.Length - i - 1); | ||
82 | Array.Resize(ref words, words.Length - 1); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | if (words.Length == 0 || words.Length > 2) | ||
87 | return; | ||
88 | |||
89 | if (words.Length == 2) // First.Last @foo.com, maybe? | ||
90 | { | ||
91 | bool found = false; | ||
92 | foreach (UserData d in m_UserCache.Values) | ||
93 | { | ||
94 | if (d.LastName.StartsWith("@") && (d.FirstName.Equals(words[0]) || d.LastName.Equals(words[1]))) | ||
95 | { | ||
96 | users.Add(d); | ||
97 | found = true; | ||
98 | break; | ||
99 | } | ||
100 | } | ||
101 | if (!found) // This is it! Let's ask the other world | ||
102 | { | ||
103 | // TODO | ||
104 | //UserAgentServiceConnector uasConn = new UserAgentServiceConnector(words[0]); | ||
105 | //uasConn.GetUserInfo(...); | ||
106 | } | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | foreach (UserData d in m_UserCache.Values) | ||
111 | { | ||
112 | if (d.LastName.StartsWith("@") && (d.FirstName.StartsWith(query) || d.LastName.StartsWith(query))) | ||
113 | users.Add(d); | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | } | ||
119 | } \ No newline at end of file | ||