public static Dictionary <string, object> GroupInviteInfo(GroupInviteInfo invite) { Dictionary <string, object> dict = new Dictionary <string, object>(); dict["InviteID"] = invite.InviteID.ToString(); dict["GroupID"] = invite.GroupID.ToString(); dict["RoleID"] = invite.RoleID.ToString(); dict["AgentID"] = invite.AgentID; return(dict); }
byte[] HandleInvite(Dictionary <string, object> request) { Dictionary <string, object> result = new Dictionary <string, object>(); if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("InviteID")) { NullResult(result, "Bad network data"); string xmlString = ServerUtils.BuildXmlResponse(result); return(Util.UTF8NoBomEncoding.GetBytes(xmlString)); } else { string op = request["OP"].ToString(); if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID")) { bool success = m_GroupsService.AddAgentToGroupInvite(request["RequestingAgentID"].ToString(), new UUID(request["InviteID"].ToString()), new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString()), request["AgentID"].ToString()); result["RESULT"] = success.ToString(); return(Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result))); } else if (op == "DELETE") { m_GroupsService.RemoveAgentToGroupInvite(request["RequestingAgentID"].ToString(), new UUID(request["InviteID"].ToString())); result["RESULT"] = "true"; return(Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result))); } else if (op == "GET") { GroupInviteInfo invite = m_GroupsService.GetAgentToGroupInvite(request["RequestingAgentID"].ToString(), new UUID(request["InviteID"].ToString())); if (invite != null) { result["RESULT"] = GroupsDataUtils.GroupInviteInfo(invite); } else { result["RESULT"] = "NULL"; } return(Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result))); } NullResult(result, "Bad OP in request"); return(Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result))); } }
public static GroupInviteInfo GroupInviteInfo(Dictionary <string, object> dict) { if (dict == null) { return(null); } GroupInviteInfo invite = new GroupInviteInfo(); invite.InviteID = new UUID(dict["InviteID"].ToString()); invite.GroupID = new UUID(dict["GroupID"].ToString()); invite.RoleID = new UUID(dict["RoleID"].ToString()); invite.AgentID = Sanitize(dict["AgentID"].ToString()); return(invite); }
public GroupInviteInfo GetAgentToGroupInvite(string RequestingAgentID, UUID inviteID) { InvitationData data = m_Database.RetrieveInvitation(inviteID); if (data == null) { return(null); } GroupInviteInfo inviteInfo = new GroupInviteInfo(); inviteInfo.AgentID = data.PrincipalID; inviteInfo.GroupID = data.GroupID; inviteInfo.InviteID = data.InviteID; inviteInfo.RoleID = data.RoleID; return(inviteInfo); }