aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-09-16 18:21:46 +0100
committerJustin Clark-Casey (justincc)2009-09-16 18:21:46 +0100
commita4c093469ae953971493977facbc81c49761577d (patch)
tree004f10f20c7e4d38088bf1eea8b5d2dd61a126df /OpenSim
parenton iar save/load, let the user know if they put in the wrong password (diff)
parentupdated the IAuthorizationService interface so that a message is passed back ... (diff)
downloadopensim-SC_OLD-a4c093469ae953971493977facbc81c49761577d.zip
opensim-SC_OLD-a4c093469ae953971493977facbc81c49761577d.tar.gz
opensim-SC_OLD-a4c093469ae953971493977facbc81c49761577d.tar.bz2
opensim-SC_OLD-a4c093469ae953971493977facbc81c49761577d.tar.xz
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/IRegionData.cs61
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs3
-rw-r--r--OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs3
-rw-r--r--OpenSim/Services/AuthorizationService/AuthorizationService.cs3
-rw-r--r--OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs4
-rw-r--r--OpenSim/Services/Interfaces/IAuthorizationService.cs2
8 files changed, 76 insertions, 9 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs
new file mode 100644
index 0000000..988bdf8
--- /dev/null
+++ b/OpenSim/Data/IRegionData.cs
@@ -0,0 +1,61 @@
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
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Data
34{
35 public class RegionData
36 {
37 public UUID RegionID;
38 public UUID ScopeID;
39 public string RegionName;
40 public int posX;
41 public int posY;
42 public Dictionary<string, object> Data;
43 }
44
45 /// <summary>
46 /// An interface for connecting to the authentication datastore
47 /// </summary>
48 public interface IRegionData
49 {
50 RegionData Get(UUID regionID, UUID ScopeID);
51 RegionData Get(string regionName, UUID ScopeID);
52 RegionData Get(int x, int y, UUID ScopeID);
53 List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);
54
55 bool Store(RegionData data);
56
57 bool SetDataItem(UUID principalID, string item, string value);
58
59 bool Delete(UUID regionID);
60 }
61}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs
index c52c257..e69613a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs
@@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
132 132
133 } 133 }
134 134
135 public bool IsAuthorizedForRegion(string userID, string regionID) 135 public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
136 { 136 {
137 return m_AuthorizationService.IsAuthorizedForRegion(userID, regionID); 137 return m_AuthorizationService.IsAuthorizedForRegion(userID, regionID, out message);
138 } 138 }
139 139
140 } 140 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
index 9241851..a672f4f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
@@ -117,11 +117,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
117 117
118 } 118 }
119 119
120 public bool IsAuthorizedForRegion(string userID, string regionID) 120 public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
121 { 121 {
122 m_log.InfoFormat("[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID); 122 m_log.InfoFormat("[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID);
123 123
124 bool isAuthorized = true; 124 bool isAuthorized = true;
125 message = String.Empty;
125 126
126 // get the scene this call is being made for 127 // get the scene this call is being made for
127 Scene scene = null; 128 Scene scene = null;
@@ -140,7 +141,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
140 { 141 {
141 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID)); 142 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID));
142 isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName, 143 isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName,
143 profile.Email, scene.RegionInfo.RegionName, regionID); 144 profile.Email, scene.RegionInfo.RegionName, regionID, out message);
144 } 145 }
145 else 146 else
146 { 147 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a8028a6..d8478a2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3250,10 +3250,11 @@ namespace OpenSim.Region.Framework.Scenes
3250 3250
3251 if (AuthorizationService != null) 3251 if (AuthorizationService != null)
3252 { 3252 {
3253 if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString())) 3253 if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString(),out reason))
3254 { 3254 {
3255 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", 3255 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
3256 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3256 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3257 //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName);
3257 return false; 3258 return false;
3258 } 3259 }
3259 } 3260 }
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
index fb079d3..69acd25 100644
--- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
@@ -60,7 +60,8 @@ namespace OpenSim.Server.Handlers.Authorization
60 XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest)); 60 XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));
61 AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request); 61 AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request);
62 62
63 bool authorized = m_AuthorizationService.IsAuthorizedForRegion(Authorization.ID, Authorization.RegionID); 63 string message = String.Empty;
64 bool authorized = m_AuthorizationService.IsAuthorizedForRegion(Authorization.ID, Authorization.RegionID,out message);
64 65
65 AuthorizationResponse result = new AuthorizationResponse(authorized, Authorization.ID + " has been authorized"); 66 AuthorizationResponse result = new AuthorizationResponse(authorized, Authorization.ID + " has been authorized");
66 67
diff --git a/OpenSim/Services/AuthorizationService/AuthorizationService.cs b/OpenSim/Services/AuthorizationService/AuthorizationService.cs
index c795ba0..d658368 100644
--- a/OpenSim/Services/AuthorizationService/AuthorizationService.cs
+++ b/OpenSim/Services/AuthorizationService/AuthorizationService.cs
@@ -48,8 +48,9 @@ namespace OpenSim.Services.AuthorizationService
48 m_log.Info("[AUTHORIZATION CONNECTOR]: Local Authorization service enabled"); 48 m_log.Info("[AUTHORIZATION CONNECTOR]: Local Authorization service enabled");
49 } 49 }
50 50
51 public bool IsAuthorizedForRegion(string userID, string regionID) 51 public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
52 { 52 {
53 message = "Authorized";
53 return true; 54 return true;
54 } 55 }
55 } 56 }
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
index 98309f1..3167352 100644
--- a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Services.Connectors
88 m_ResponseOnFailure = responseOnFailure; 88 m_ResponseOnFailure = responseOnFailure;
89 } 89 }
90 90
91 public bool IsAuthorizedForRegion(string userID, string firstname, string surname, string email, string regionName, string regionID) 91 public bool IsAuthorizedForRegion(string userID, string firstname, string surname, string email, string regionName, string regionID, out string message)
92 { 92 {
93 // do a remote call to the authorization server specified in the AuthorizationServerURI 93 // do a remote call to the authorization server specified in the AuthorizationServerURI
94 m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} at remote server {1}", userID, m_ServerURI); 94 m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} at remote server {1}", userID, m_ServerURI);
@@ -105,10 +105,12 @@ namespace OpenSim.Services.Connectors
105 catch (Exception e) 105 catch (Exception e)
106 { 106 {
107 m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message); 107 m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message);
108 message="";
108 return m_ResponseOnFailure; 109 return m_ResponseOnFailure;
109 } 110 }
110 111
111 m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}", response.Message); 112 m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}", response.Message);
113 message = response.Message;
112 114
113 return response.IsAuthorized; 115 return response.IsAuthorized;
114 } 116 }
diff --git a/OpenSim/Services/Interfaces/IAuthorizationService.cs b/OpenSim/Services/Interfaces/IAuthorizationService.cs
index 91afa9a..c5d577a 100644
--- a/OpenSim/Services/Interfaces/IAuthorizationService.cs
+++ b/OpenSim/Services/Interfaces/IAuthorizationService.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Services.Interfaces
40 // This method returns a simple true false indicating 40 // This method returns a simple true false indicating
41 // whether or not a user has access to the region 41 // whether or not a user has access to the region
42 // 42 //
43 bool IsAuthorizedForRegion(string userID, string regionID); 43 bool IsAuthorizedForRegion(string userID, string regionID, out string message);
44 44
45 } 45 }
46 46