aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs49
1 files changed, 45 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
index b0d8baa..88e6ee2 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
@@ -35,6 +35,7 @@ using OpenSim.Services.Connectors;
35using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using OpenMetaverse;
38 39
39namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization 40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
40{ 41{
@@ -46,6 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
46 MethodBase.GetCurrentMethod().DeclaringType); 47 MethodBase.GetCurrentMethod().DeclaringType);
47 48
48 private bool m_Enabled = false; 49 private bool m_Enabled = false;
50 private List<Scene> m_scenes = new List<Scene>();
49 51
50 public Type ReplaceableInterface 52 public Type ReplaceableInterface
51 { 53 {
@@ -68,7 +70,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
68 IConfig authorizationConfig = source.Configs["AuthorizationService"]; 70 IConfig authorizationConfig = source.Configs["AuthorizationService"];
69 if (authorizationConfig == null) 71 if (authorizationConfig == null)
70 { 72 {
71 m_log.Error("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini"); 73 m_log.Error("[REMOTE AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini");
72 return; 74 return;
73 } 75 }
74 76
@@ -76,7 +78,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
76 78
77 base.Initialise(source); 79 base.Initialise(source);
78 80
79 m_log.Info("[AUTHORIZATION CONNECTOR]: Remote authorization enabled"); 81 m_log.Info("[REMOTE AUTHORIZATION CONNECTOR]: Remote authorization enabled");
80 } 82 }
81 } 83 }
82 } 84 }
@@ -94,7 +96,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
94 if (!m_Enabled) 96 if (!m_Enabled)
95 return; 97 return;
96 98
97 scene.RegisterModuleInterface<IAuthorizationService>(this); 99 if (!m_scenes.Contains(scene))
100 {
101 m_scenes.Add(scene);
102 scene.RegisterModuleInterface<IAuthorizationService>(this);
103 }
104
98 } 105 }
99 106
100 public void RemoveRegion(Scene scene) 107 public void RemoveRegion(Scene scene)
@@ -106,8 +113,42 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
106 if (!m_Enabled) 113 if (!m_Enabled)
107 return; 114 return;
108 115
109 m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: Enabled remote authorization for region {0}", scene.RegionInfo.RegionName); 116 m_log.InfoFormat("[REMOTE AUTHORIZATION CONNECTOR]: Enabled remote authorization for region {0}", scene.RegionInfo.RegionName);
110 117
111 } 118 }
119
120 public bool IsAuthorizedForRegion(string userID, string regionID)
121 {
122 m_log.InfoFormat("[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID);
123
124 bool isAuthorized = true;
125
126 // get the scene this call is being made for
127 Scene scene = null;
128 lock (m_scenes)
129 {
130 foreach (Scene nextScene in m_scenes)
131 {
132 if (nextScene.RegionInfo.RegionID.ToString() == regionID)
133 {
134 scene = nextScene;
135 }
136 }
137 }
138
139 if(scene!=null)
140 {
141 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID));
142 isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName,profile.Email,scene.RegionInfo.RegionName,regionID);
143 }
144 else
145 {
146 m_log.ErrorFormat("[REMOTE AUTHORIZATION CONNECTOR] IsAuthorizedForRegion, can't find scene to match region id of {0} ",regionID);
147 }
148
149
150 return isAuthorized;
151
152 }
112 } 153 }
113} 154}