aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-07-31 21:32:20 +0100
committerJustin Clark-Casey (justincc)2014-07-31 21:32:20 +0100
commitdfd0c2a54ab345e6120ae7f8d75870959771ef11 (patch)
tree1990e034ae4343508b681cf0696cedadcd83bf74
parentDon't overwrite the null result with the true result is groups service REMOVE... (diff)
downloadopensim-SC_OLD-dfd0c2a54ab345e6120ae7f8d75870959771ef11.zip
opensim-SC_OLD-dfd0c2a54ab345e6120ae7f8d75870959771ef11.tar.gz
opensim-SC_OLD-dfd0c2a54ab345e6120ae7f8d75870959771ef11.tar.bz2
opensim-SC_OLD-dfd0c2a54ab345e6120ae7f8d75870959771ef11.tar.xz
If REMOVEAGENTFROMGROUP core groups call fails because requesting agent does not have sufficient permission, return null failure result rather than true.
On non-HG this is on the only recognized failure state so we can return more information in the error result. On HG there are multiple failure states which would require more work to distinguish, so currently return the unsatisfying "Internal Error" like some other existing calls.
-rw-r--r--OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs7
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs7
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsService.cs6
-rw-r--r--OpenSim/Addons/Groups/Service/HGGroupsService.cs12
4 files changed, 22 insertions, 10 deletions
diff --git a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
index 207d810..f60c1a5 100644
--- a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
@@ -209,9 +209,10 @@ namespace OpenSim.Groups
209 string agentID = request["AgentID"].ToString(); 209 string agentID = request["AgentID"].ToString();
210 string token = request["AccessToken"].ToString(); 210 string token = request["AccessToken"].ToString();
211 211
212 m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token); 212 if (!m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token))
213 213 NullResult(result, "Internal error");
214 result["RESULT"] = "true"; 214 else
215 result["RESULT"] = "true";
215 } 216 }
216 217
217 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 218 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
index 5cf6ec7..26e844e 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
@@ -285,9 +285,10 @@ namespace OpenSim.Groups
285 string agentID = request["AgentID"].ToString(); 285 string agentID = request["AgentID"].ToString();
286 string requestingAgentID = request["RequestingAgentID"].ToString(); 286 string requestingAgentID = request["RequestingAgentID"].ToString();
287 287
288 m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID); 288 if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
289 289 NullResult(result, string.Format("Insufficient permissions.", agentID));
290 result["RESULT"] = "true"; 290 else
291 result["RESULT"] = "true";
291 } 292 }
292 293
293 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 294 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index 037ef59..f44c094 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -393,13 +393,15 @@ namespace OpenSim.Groups
393 return true; 393 return true;
394 } 394 }
395 395
396 public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID) 396 public bool RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
397 { 397 {
398 // check perms 398 // check perms
399 if (RequestingAgentID != AgentID && !HasPower(RequestingAgentID, GroupID, GroupPowers.Eject)) 399 if (RequestingAgentID != AgentID && !HasPower(RequestingAgentID, GroupID, GroupPowers.Eject))
400 return; 400 return false;
401 401
402 _RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID); 402 _RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
403
404 return true;
403 } 405 }
404 406
405 public bool AddAgentToGroupInvite(string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, string agentID) 407 public bool AddAgentToGroupInvite(string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, string agentID)
diff --git a/OpenSim/Addons/Groups/Service/HGGroupsService.cs b/OpenSim/Addons/Groups/Service/HGGroupsService.cs
index 9d7961c..56e999b 100644
--- a/OpenSim/Addons/Groups/Service/HGGroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/HGGroupsService.cs
@@ -131,19 +131,27 @@ namespace OpenSim.Groups
131 return true; 131 return true;
132 } 132 }
133 133
134 public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID, string token) 134 public bool RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID, string token)
135 { 135 {
136 // check the token 136 // check the token
137 MembershipData membership = m_Database.RetrieveMember(GroupID, AgentID); 137 MembershipData membership = m_Database.RetrieveMember(GroupID, AgentID);
138 if (membership != null) 138 if (membership != null)
139 { 139 {
140 if (token != string.Empty && token.Equals(membership.Data["AccessToken"])) 140 if (token != string.Empty && token.Equals(membership.Data["AccessToken"]))
141 RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID); 141 {
142 return RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
143 }
142 else 144 else
145 {
143 m_log.DebugFormat("[Groups.HGGroupsService]: access token {0} did not match stored one {1}", token, membership.Data["AccessToken"]); 146 m_log.DebugFormat("[Groups.HGGroupsService]: access token {0} did not match stored one {1}", token, membership.Data["AccessToken"]);
147 return false;
148 }
144 } 149 }
145 else 150 else
151 {
146 m_log.DebugFormat("[Groups.HGGroupsService]: membership not found for {0}", AgentID); 152 m_log.DebugFormat("[Groups.HGGroupsService]: membership not found for {0}", AgentID);
153 return false;
154 }
147 } 155 }
148 156
149 public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string groupName, string token) 157 public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string groupName, string token)