public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason) { string url = string.Empty; string name = string.Empty; reason = string.Empty; UUID uid = new UUID(AgentID); if (IsLocal(GroupID, out url, out name)) { if (m_UserManagement.IsLocalGridUser(uid)) // local user { // normal case: local group, local user return(m_LocalGroupsConnector.AddAgentToGroup(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID, RoleID, token, out reason)); } else // local group, foreign user { // the user is accepting the invitation, or joining, where the group resides token = UUID.Random().ToString(); bool success = m_LocalGroupsConnector.AddAgentToGroup(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID, RoleID, token, out reason); if (success) { // Here we always return true. The user has been added to the local group, // independent of whether the remote operation succeeds or not url = m_UserManagement.GetUserServerURL(uid, "GroupsServerURI"); if (url == string.Empty) { reason = "You don't have an accessible groups server in your home world. You membership to this group in only within this grid."; return(true); } GroupsServiceHGConnector c = GetConnector(url); if (c != null) { c.CreateProxy(AgentUUI(RequestingAgentID), AgentID, token, GroupID, m_LocalGroupsServiceLocation, name, out reason); } return(true); } return(false); } } else if (m_UserManagement.IsLocalGridUser(uid)) // local user { // foreign group, local user. She's been added already by the HG service. // Let's just check if (m_LocalGroupsConnector.GetAgentGroupMembership(AgentUUI(RequestingAgentID), AgentUUI(AgentID), GroupID) != null) { return(true); } } reason = "Operation not allowed outside this group's origin world"; return(false); }