diff --git a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs index 207d810ecb..f60c1a5f68 100644 --- a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs @@ -209,9 +209,10 @@ namespace OpenSim.Groups string agentID = request["AgentID"].ToString(); string token = request["AccessToken"].ToString(); - m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token); - - result["RESULT"] = "true"; + if (!m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token)) + NullResult(result, "Internal error"); + else + result["RESULT"] = "true"; } //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 5cf6ec70d4..26e844eb57 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs @@ -285,9 +285,10 @@ namespace OpenSim.Groups string agentID = request["AgentID"].ToString(); string requestingAgentID = request["RequestingAgentID"].ToString(); - m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID); - - result["RESULT"] = "true"; + if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID)) + NullResult(result, string.Format("Insufficient permissions.", agentID)); + else + result["RESULT"] = "true"; } //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 037ef59b9e..f44c094b2b 100644 --- a/OpenSim/Addons/Groups/Service/GroupsService.cs +++ b/OpenSim/Addons/Groups/Service/GroupsService.cs @@ -393,13 +393,15 @@ namespace OpenSim.Groups return true; } - public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID) + public bool RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID) { // check perms if (RequestingAgentID != AgentID && !HasPower(RequestingAgentID, GroupID, GroupPowers.Eject)) - return; + return false; _RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID); + + return true; } 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 9d7961cd20..56e999bde4 100644 --- a/OpenSim/Addons/Groups/Service/HGGroupsService.cs +++ b/OpenSim/Addons/Groups/Service/HGGroupsService.cs @@ -131,19 +131,27 @@ namespace OpenSim.Groups return true; } - public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID, string token) + public bool RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID, string token) { // check the token MembershipData membership = m_Database.RetrieveMember(GroupID, AgentID); if (membership != null) { if (token != string.Empty && token.Equals(membership.Data["AccessToken"])) - RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID); + { + return RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID); + } else + { m_log.DebugFormat("[Groups.HGGroupsService]: access token {0} did not match stored one {1}", token, membership.Data["AccessToken"]); + return false; + } } else + { m_log.DebugFormat("[Groups.HGGroupsService]: membership not found for {0}", AgentID); + return false; + } } public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string groupName, string token)