31 using System.Collections.Generic;
32 using System.Reflection;
34 using OpenSim.Framework;
35 using OpenSim.Services.Connectors;
36 using OpenSim.Region.Framework.Interfaces;
37 using OpenSim.Region.Framework.Scenes;
38 using OpenSim.Services.Interfaces;
41 namespace OpenSim.
Region.CoreModules.ServiceConnectorsOut.Authorization
43 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"RemoteAuthorizationServicesConnector")]
47 private static readonly ILog m_log =
49 MethodBase.GetCurrentMethod().DeclaringType);
51 private bool m_Enabled =
false;
52 private List<Scene> m_scenes =
new List<Scene>();
54 public Type ReplaceableInterface
61 get {
return "RemoteAuthorizationServicesConnector"; }
66 IConfig moduleConfig = source.Configs[
"Modules"];
67 if (moduleConfig != null)
69 string name = moduleConfig.GetString(
"AuthorizationServices",
"");
72 IConfig authorizationConfig = source.Configs[
"AuthorizationService"];
73 if (authorizationConfig == null)
75 m_log.Info(
"[REMOTE AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini");
81 base.Initialise(source);
83 m_log.Info(
"[REMOTE AUTHORIZATION CONNECTOR]: Remote authorization enabled");
101 if (!m_scenes.Contains(scene))
118 m_log.InfoFormat(
"[REMOTE AUTHORIZATION CONNECTOR]: Enabled remote authorization for region {0}", scene.RegionInfo.RegionName);
123 string userID,
string firstName,
string lastName,
string regionID, out
string message)
126 "[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID);
128 bool isAuthorized =
true;
129 message = String.Empty;
135 foreach (
Scene nextScene
in m_scenes)
146 string mail = String.Empty;
148 UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero,
new UUID(userID));
153 mail = account.Email;
154 firstName = account.FirstName;
155 lastName = account.LastName;
159 = IsAuthorizedForRegion(
165 "[REMOTE AUTHORIZATION CONNECTOR] IsAuthorizedForRegion, can't find scene to match region id of {0}",
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
bool IsAuthorizedForRegion(string userID, string firstName, string lastName, string regionID, out string message)
Check whether the user should be given access to the region.
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
override void Initialise(IConfigSource source)
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
virtual RegionInfo RegionInfo
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...