diff options
author | onefang | 2020-09-11 00:41:12 +1000 |
---|---|---|
committer | onefang | 2020-09-11 00:41:12 +1000 |
commit | b95b03b409578da87f1dbaf809001e88e4e4fd56 (patch) | |
tree | 1db95cf20313408ef581377ae8e508d6d01cea00 /OpenSim/Region/CoreModules/ServiceConnectorsOut | |
parent | Add DefaultRegionAccess in [AuthorizationService] section. (diff) | |
download | opensim-SC-b95b03b409578da87f1dbaf809001e88e4e4fd56.zip opensim-SC-b95b03b409578da87f1dbaf809001e88e4e4fd56.tar.gz opensim-SC-b95b03b409578da87f1dbaf809001e88e4e4fd56.tar.bz2 opensim-SC-b95b03b409578da87f1dbaf809001e88e4e4fd56.tar.xz |
Automatically add members to certain groups, and HGers from specific grids to certain other groups.
It doesn't let them know, though the last group added will be their
active group. This replaces a PHP script I used to use, that got broken
by a PHP update. It also didn't let people know, no one complained.
This is better.
Another attempt at sorting out the auto group chicken and egg problems.
Are you a local? Asking for a friend.
Hypergridders have their full name in firstname, and their grid in
lastname. Sometimes.
Code filled with gotos may be spaghetti code, but object oriented code
can be like chopped spaghetti that's hidden all over the kitchen. At
least with gotos you can follow them.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut')
3 files changed, 15 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs index 2e06bc8..91e0ebc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs | |||
@@ -88,8 +88,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
88 | } | 88 | } |
89 | 89 | ||
90 | public bool IsAuthorizedForRegion( | 90 | public bool IsAuthorizedForRegion( |
91 | string user, string firstName, string lastName, string regionID, out string message) | 91 | string user, string firstName, string lastName, string regionID, out string message, out bool isLocal) |
92 | { | 92 | { |
93 | UUID userID = new UUID(user); | ||
94 | isLocal = m_UserManagement.IsLocalGridUser(userID); | ||
95 | |||
93 | // This should not happen | 96 | // This should not happen |
94 | if (m_Scene.RegionInfo.RegionID.ToString() != regionID) | 97 | if (m_Scene.RegionInfo.RegionID.ToString() != regionID) |
95 | { | 98 | { |
@@ -105,11 +108,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
105 | return true; | 108 | return true; |
106 | } | 109 | } |
107 | 110 | ||
108 | UUID userID = new UUID(user); | 111 | //// UUID userID = new UUID(user); |
109 | 112 | ||
110 | if ((m_accessValue & AccessFlags.DisallowForeigners) != 0) | 113 | if ((m_accessValue & AccessFlags.DisallowForeigners) != 0) |
111 | { | 114 | { |
112 | if (!m_UserManagement.IsLocalGridUser(userID)) | 115 | if (!isLocal) |
113 | { | 116 | { |
114 | message = "No foreign users allowed in this region"; | 117 | message = "No foreign users allowed in this region"; |
115 | return false; | 118 | return false; |
@@ -130,4 +133,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
130 | } | 133 | } |
131 | 134 | ||
132 | } | 135 | } |
133 | } \ No newline at end of file | 136 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs index 0be0676..59ffc1d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs | |||
@@ -114,13 +114,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
114 | } | 114 | } |
115 | 115 | ||
116 | public bool IsAuthorizedForRegion( | 116 | public bool IsAuthorizedForRegion( |
117 | string userID, string firstName, string lastName, string regionID, out string message) | 117 | string userID, string firstName, string lastName, string regionID, out string message, out bool isLocal) |
118 | { | 118 | { |
119 | message = ""; | 119 | message = ""; |
120 | isLocal = false; | ||
120 | if (!m_Enabled) | 121 | if (!m_Enabled) |
121 | return true; | 122 | return true; |
122 | 123 | ||
123 | return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message); | 124 | return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message, out isLocal); |
124 | } | 125 | } |
125 | } | 126 | } |
126 | } \ No newline at end of file | 127 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs index f312b0d..f06180a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs | |||
@@ -120,7 +120,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
120 | } | 120 | } |
121 | 121 | ||
122 | public bool IsAuthorizedForRegion( | 122 | public bool IsAuthorizedForRegion( |
123 | string userID, string firstName, string lastName, string regionID, out string message) | 123 | string userID, string firstName, string lastName, string regionID, out string message, out bool isLocal) |
124 | { | 124 | { |
125 | m_log.InfoFormat( | 125 | m_log.InfoFormat( |
126 | "[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID); | 126 | "[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID); |
@@ -141,6 +141,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | isLocal = false; | ||
144 | if (scene != null) | 145 | if (scene != null) |
145 | { | 146 | { |
146 | string mail = String.Empty; | 147 | string mail = String.Empty; |
@@ -153,6 +154,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
153 | mail = account.Email; | 154 | mail = account.Email; |
154 | firstName = account.FirstName; | 155 | firstName = account.FirstName; |
155 | lastName = account.LastName; | 156 | lastName = account.LastName; |
157 | isLocal = true; | ||
156 | } | 158 | } |
157 | 159 | ||
158 | isAuthorized | 160 | isAuthorized |
@@ -169,4 +171,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
169 | return isAuthorized; | 171 | return isAuthorized; |
170 | } | 172 | } |
171 | } | 173 | } |
172 | } \ No newline at end of file | 174 | } |