ExtendedGroupRecord _GroupDataToRecord(GroupData data) { if (data == null) { return(null); } ExtendedGroupRecord rec = new ExtendedGroupRecord(); rec.AllowPublish = data.Data["AllowPublish"] == "1" ? true : false; rec.Charter = data.Data["Charter"]; rec.FounderID = new UUID(data.Data["FounderID"]); rec.GroupID = data.GroupID; rec.GroupName = data.Data["Name"]; rec.GroupPicture = new UUID(data.Data["InsigniaID"]); rec.MaturePublish = data.Data["MaturePublish"] == "1" ? true : false; rec.MembershipFee = Int32.Parse(data.Data["MembershipFee"]); rec.OpenEnrollment = data.Data["OpenEnrollment"] == "1" ? true : false; rec.OwnerRoleID = new UUID(data.Data["OwnerRoleID"]); rec.ShowInList = data.Data["ShowInList"] == "1" ? true : false; rec.ServiceLocation = data.Data["Location"]; rec.MemberCount = m_Database.MemberCount(data.GroupID); rec.RoleCount = m_Database.RoleCount(data.GroupID); return(rec); }
public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID, out string reason) { reason = string.Empty; ExtendedGroupRecord rec = new ExtendedGroupRecord(); rec.AllowPublish = allowPublish; rec.Charter = charter; rec.FounderID = founderID; rec.GroupName = name; rec.GroupPicture = insigniaID; rec.MaturePublish = maturePublish; rec.MembershipFee = membershipFee; rec.OpenEnrollment = openEnrollment; rec.ShowInList = showInList; Dictionary<string, object> sendData = GroupsDataUtils.GroupRecord(rec); sendData["RequestingAgentID"] = RequestingAgentID; sendData["OP"] = "ADD"; Dictionary<string, object> ret = MakeRequest("PUTGROUP", sendData); if (ret == null) return null; if (ret["RESULT"].ToString() == "NULL") { reason = ret["REASON"].ToString(); return null; } return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]); }
public UUID CreateGroup(UUID RequestingAgentID, GroupRecordDelegate d) { //m_log.DebugFormat("[Groups.RemoteConnector]: Creating group {0}", name); //reason = string.Empty; //ExtendedGroupRecord group = m_GroupsService.CreateGroup(RequestingAgentID.ToString(), name, charter, showInList, insigniaID, // membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason); ExtendedGroupRecord group = d(); if (group == null) { return(UUID.Zero); } if (group.GroupID != UUID.Zero) { lock (m_Cache) { m_Cache.Add("group-" + group.GroupID.ToString(), group, GROUPS_CACHE_TIMEOUT); if (m_Cache.Contains("memberships-" + RequestingAgentID.ToString())) { m_Cache.Remove("memberships-" + RequestingAgentID.ToString()); } } } return(group.GroupID); }
private bool IsLocal(UUID groupID, out string serviceLocation, out string name) { if (m_log.IsDebugEnabled) { m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } serviceLocation = string.Empty; name = string.Empty; if (groupID.Equals(UUID.Zero)) { return(true); } ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty); if (group == null) { //m_log.DebugFormat("[XXX]: IsLocal? group {0} not found -- no.", groupID); return(false); } serviceLocation = group.ServiceLocation; name = group.GroupName; bool isLocal = (group.ServiceLocation == string.Empty); //m_log.DebugFormat("[XXX]: IsLocal? {0}", isLocal); return(isLocal); }
public static Dictionary <string, object> GroupRecord(ExtendedGroupRecord grec) { Dictionary <string, object> dict = new Dictionary <string, object>(); if (grec == null) { return(dict); } dict["AllowPublish"] = grec.AllowPublish.ToString(); dict["Charter"] = Sanitize(grec.Charter); dict["FounderID"] = grec.FounderID.ToString(); dict["FounderUUI"] = Sanitize(grec.FounderUUI); dict["GroupID"] = grec.GroupID.ToString(); dict["GroupName"] = Sanitize(grec.GroupName); dict["InsigniaID"] = grec.GroupPicture.ToString(); dict["MaturePublish"] = grec.MaturePublish.ToString(); dict["MembershipFee"] = grec.MembershipFee.ToString(); dict["OpenEnrollment"] = grec.OpenEnrollment.ToString(); dict["OwnerRoleID"] = grec.OwnerRoleID.ToString(); dict["ServiceLocation"] = Sanitize(grec.ServiceLocation); dict["ShownInList"] = grec.ShowInList.ToString(); dict["MemberCount"] = grec.MemberCount.ToString(); dict["RoleCount"] = grec.RoleCount.ToString(); return(dict); }
public ExtendedGroupRecord UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) { ExtendedGroupRecord rec = new ExtendedGroupRecord(); rec.AllowPublish = allowPublish; rec.Charter = charter; rec.GroupPicture = insigniaID; rec.MaturePublish = maturePublish; rec.GroupID = groupID; rec.MembershipFee = membershipFee; rec.OpenEnrollment = openEnrollment; rec.ShowInList = showInList; Dictionary <string, object> sendData = GroupsDataUtils.GroupRecord(rec); sendData["RequestingAgentID"] = RequestingAgentID; sendData["OP"] = "UPDATE"; Dictionary <string, object> ret = MakeRequest("PUTGROUP", sendData); if (ret == null || (ret != null && (!ret.ContainsKey("RESULT") || ret["RESULT"].ToString() == "NULL"))) { return(null); } return(GroupsDataUtils.GroupRecord((Dictionary <string, object>)ret["RESULT"])); }
private void FillFounderUUI(ExtendedGroupRecord grec) { UserAccount account = m_UserAccounts.GetUserAccount(UUID.Zero, grec.FounderID); if (account != null) { grec.FounderUUI = Util.UniversalIdentifier(account.PrincipalID, account.FirstName, account.LastName, m_HomeURI); } }
public bool UpdateGroup(UUID groupID, GroupRecordDelegate d) { //reason = string.Empty; //ExtendedGroupRecord group = m_GroupsService.UpdateGroup(RequestingAgentID, groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish); ExtendedGroupRecord group = d(); if (group != null && group.GroupID != UUID.Zero) { lock (m_Cache) m_Cache.AddOrUpdate("group-" + group.GroupID.ToString(), group, GROUPS_CACHE_TIMEOUT); } return(true); }
byte[] HandleAddOrUpdateGroup(Dictionary <string, object> request) { Dictionary <string, object> result = new Dictionary <string, object>(); ExtendedGroupRecord grec = GroupsDataUtils.GroupRecord(request); if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("OP")) { NullResult(result, "Bad network data"); } else { string RequestingAgentID = request["RequestingAgentID"].ToString(); string reason = string.Empty; string op = request["OP"].ToString(); if (op == "ADD") { grec.GroupID = m_GroupsService.CreateGroup(RequestingAgentID, grec.GroupName, grec.Charter, grec.ShowInList, grec.GroupPicture, grec.MembershipFee, grec.OpenEnrollment, grec.AllowPublish, grec.MaturePublish, grec.FounderID, out reason); } else if (op == "UPDATE") { m_GroupsService.UpdateGroup(RequestingAgentID, grec.GroupID, grec.Charter, grec.ShowInList, grec.GroupPicture, grec.MembershipFee, grec.OpenEnrollment, grec.AllowPublish, grec.MaturePublish); } if (grec.GroupID != UUID.Zero) { grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID); if (grec == null) { NullResult(result, "Internal Error"); } else { result["RESULT"] = GroupsDataUtils.GroupRecord(grec); } } else { NullResult(result, reason); } } string xmlString = ServerUtils.BuildXmlResponse(result); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); return(Util.UTF8NoBomEncoding.GetBytes(xmlString)); }
public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName) { if (m_log.IsDebugEnabled) { m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } string url = string.Empty; string name = string.Empty; if (IsLocal(GroupID, out url, out name)) { return(m_LocalGroupsConnector.GetGroupRecord(AgentUUI(RequestingAgentID), GroupID, GroupName)); } else if (url != string.Empty) { ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID); string accessToken = string.Empty; if (membership != null) { accessToken = membership.AccessToken; } else { return(null); } GroupsServiceHGConnector c = GetConnector(url); if (c != null) { ExtendedGroupRecord grec = m_CacheWrapper.GetGroupRecord(RequestingAgentID, GroupID, GroupName, delegate { return(c.GetGroupRecord(AgentUUIForOutside(RequestingAgentID), GroupID, GroupName, accessToken)); }); if (grec != null) { ImportForeigner(grec.FounderUUI); } return(grec); } } return(null); }
public bool AddNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID) { // check that the group proxy exists ExtendedGroupRecord grec = GetGroupRecord(RequestingAgentID, groupID); if (grec == null) { m_log.DebugFormat("[Groups.HGGroupsService]: attempt at adding notice to non-existent group proxy"); return(false); } // check that the group is remote if (grec.ServiceLocation == string.Empty) { m_log.DebugFormat("[Groups.HGGroupsService]: attempt at adding notice to local (non-proxy) group"); return(false); } // check that there isn't already a notice with the same ID if (GetGroupNotice(RequestingAgentID, noticeID) != null) { m_log.DebugFormat("[Groups.HGGroupsService]: a notice with the same ID already exists", grec.ServiceLocation); return(false); } // This has good intentions (security) but it will potentially DDS the origin... // We'll need to send a proof along with the message. Maybe encrypt the message // using key pairs // //// check that the notice actually exists in the origin //GroupsServiceHGConnector c = new GroupsServiceHGConnector(grec.ServiceLocation); //if (!c.VerifyNotice(noticeID, groupID)) //{ // m_log.DebugFormat("[Groups.HGGroupsService]: notice does not exist at origin {0}", grec.ServiceLocation); // return false; //} // ok, we're good! return(_AddNotice(groupID, noticeID, fromName, subject, message, hasAttachment, attType, attName, attItemID, attOwnerID)); }
byte[] HandleGetGroup(Dictionary <string, object> request) { Dictionary <string, object> result = new Dictionary <string, object>(); if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("AccessToken")) { NullResult(result, "Bad network data"); } else { string RequestingAgentID = request["RequestingAgentID"].ToString(); string token = request["AccessToken"].ToString(); UUID groupID = UUID.Zero; string groupName = string.Empty; if (request.ContainsKey("GroupID")) { groupID = new UUID(request["GroupID"].ToString()); } if (request.ContainsKey("Name")) { groupName = request["Name"].ToString(); } ExtendedGroupRecord grec = m_GroupsService.GetGroupRecord(RequestingAgentID, groupID, groupName, token); if (grec == null) { NullResult(result, "Group not found"); } else { result["RESULT"] = GroupsDataUtils.GroupRecord(grec); } } string xmlString = ServerUtils.BuildXmlResponse(result); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); return(Util.UTF8NoBomEncoding.GetBytes(xmlString)); }
public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName) { string url = string.Empty; string name = string.Empty; if (IsLocal(GroupID, out url, out name)) { return(m_LocalGroupsConnector.GetGroupRecord(AgentUUI(RequestingAgentID), GroupID, GroupName)); } else if (url != string.Empty) { ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID); string accessToken = string.Empty; if (membership != null) { accessToken = membership.AccessToken; } else { return(null); } GroupsServiceHGConnector c = GetConnector(url); if (c != null) { ExtendedGroupRecord grec = m_CacheWrapper.GetGroupRecord(RequestingAgentID, GroupID, GroupName, delegate { return(c.GetGroupRecord(AgentUUIForOutside(RequestingAgentID), GroupID, GroupName, accessToken)); }); if (grec != null) { ImportForeigner(grec.FounderUUI); } return(grec); } } return(null); }
public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID, out string reason) { reason = string.Empty; ExtendedGroupRecord rec = new ExtendedGroupRecord(); rec.AllowPublish = allowPublish; rec.Charter = charter; rec.FounderID = founderID; rec.GroupName = name; rec.GroupPicture = insigniaID; rec.MaturePublish = maturePublish; rec.MembershipFee = membershipFee; rec.OpenEnrollment = openEnrollment; rec.ShowInList = showInList; Dictionary <string, object> sendData = GroupsDataUtils.GroupRecord(rec); sendData["RequestingAgentID"] = RequestingAgentID; sendData["OP"] = "ADD"; Dictionary <string, object> ret = MakeRequest("PUTGROUP", sendData); if (ret == null) { return(null); } if (ret["RESULT"].ToString() == "NULL") { reason = ret["REASON"].ToString(); return(null); } return(GroupsDataUtils.GroupRecord((Dictionary <string, object>)ret["RESULT"])); }
private bool IsLocal(UUID groupID, out string serviceLocation, out string name) { serviceLocation = string.Empty; name = string.Empty; if (groupID.Equals(UUID.Zero)) { return(true); } ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty); if (group == null) { //m_log.DebugFormat("[XXX]: IsLocal? group {0} not found -- no.", groupID); return(false); } serviceLocation = group.ServiceLocation; name = group.GroupName; bool isLocal = (group.ServiceLocation == string.Empty); //m_log.DebugFormat("[XXX]: IsLocal? {0}", isLocal); return(isLocal); }
public void SendMessageToGroup( GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func <GroupMembersData, bool> sendCondition) { int requestStartTick = Environment.TickCount; UUID fromAgentID = new UUID(im.fromAgentID); // Unlike current XmlRpcGroups, Groups V2 can accept UUID.Zero when a perms check for the requesting agent // is not necessary. List <GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), groupID); int groupMembersCount = groupMembers.Count; PresenceInfo[] onlineAgents = null; // In V2 we always only send to online members. // Sending to offline members is not an option. // We cache in order not to overwhelm the presence service on large grids with many groups. This does // mean that members coming online will not see all group members until after m_usersOnlineCacheExpirySeconds has elapsed. // (assuming this is the same across all grid simulators). if (!m_usersOnlineCache.TryGetValue(groupID, out onlineAgents)) { string[] t1 = groupMembers.ConvertAll <string>(gmd => gmd.AgentID.ToString()).ToArray(); onlineAgents = m_presenceService.GetAgents(t1); m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); } HashSet <string> onlineAgentsUuidSet = new HashSet <string>(); Array.ForEach <PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID)); groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); // if (m_debugEnabled) // m_log.DebugFormat( // "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online", // groupID, groupMembersCount, groupMembers.Count()); im.imSessionID = groupID.Guid; im.fromGroup = true; IClientAPI thisClient = GetActiveClient(fromAgentID); if (thisClient != null) { im.RegionID = thisClient.Scene.RegionInfo.RegionID.Guid; } if ((im.binaryBucket == null) || (im.binaryBucket.Length == 0) || ((im.binaryBucket.Length == 1 && im.binaryBucket[0] == 0))) { ExtendedGroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), groupID, null); if (groupInfo != null) { im.binaryBucket = Util.StringToBytes256(groupInfo.GroupName); } } // Send to self first of all im.toAgentID = im.fromAgentID; im.fromGroup = true; ProcessMessageFromGroupSession(im); List <UUID> regions = new List <UUID>(); List <UUID> clientsAlreadySent = new List <UUID>(); // Then send to everybody else foreach (GroupMembersData member in groupMembers) { if (member.AgentID.Guid == im.fromAgentID) { continue; } if (clientsAlreadySent.Contains(member.AgentID)) { continue; } clientsAlreadySent.Add(member.AgentID); if (sendCondition != null) { if (!sendCondition(member)) { if (m_debugEnabled) { m_log.DebugFormat( "[Groups.Messaging]: Not sending to {0} as they do not fulfill send condition", member.AgentID); } continue; } } else if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID)) { // Don't deliver messages to people who have dropped this session if (m_debugEnabled) { m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID); } continue; } im.toAgentID = member.AgentID.Guid; IClientAPI client = GetActiveClient(member.AgentID); if (client == null) { // If they're not local, forward across the grid // BUT do it only once per region, please! Sim would be even better! if (m_debugEnabled) { m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} via Grid", member.AgentID); } bool reallySend = true; if (onlineAgents != null) { PresenceInfo presence = onlineAgents.First(p => p.UserID == member.AgentID.ToString()); if (regions.Contains(presence.RegionID)) { reallySend = false; } else { regions.Add(presence.RegionID); } } if (reallySend) { // We have to create a new IM structure because the transfer module // uses async send GridInstantMessage msg = new GridInstantMessage(im, true); m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); } } else { // Deliver locally, directly if (m_debugEnabled) { m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); } ProcessMessageFromGroupSession(im); } } if (m_debugEnabled) { m_log.DebugFormat( "[Groups.Messaging]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms", groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick); } }
public static ExtendedGroupRecord GroupRecord(Dictionary<string, object> dict) { if (dict == null) return null; ExtendedGroupRecord grec = new ExtendedGroupRecord(); if (dict.ContainsKey("AllowPublish") && dict["AllowPublish"] != null) grec.AllowPublish = bool.Parse(dict["AllowPublish"].ToString()); if (dict.ContainsKey("Charter") && dict["Charter"] != null) grec.Charter = dict["Charter"].ToString(); else grec.Charter = string.Empty; if (dict.ContainsKey("FounderID") && dict["FounderID"] != null) grec.FounderID = UUID.Parse(dict["FounderID"].ToString()); if (dict.ContainsKey("FounderUUI") && dict["FounderUUI"] != null) grec.FounderUUI = dict["FounderUUI"].ToString(); else grec.FounderUUI = string.Empty; if (dict.ContainsKey("GroupID") && dict["GroupID"] != null) grec.GroupID = UUID.Parse(dict["GroupID"].ToString()); if (dict.ContainsKey("GroupName") && dict["GroupName"] != null) grec.GroupName = dict["GroupName"].ToString(); else grec.GroupName = string.Empty; if (dict.ContainsKey("InsigniaID") && dict["InsigniaID"] != null) grec.GroupPicture = UUID.Parse(dict["InsigniaID"].ToString()); if (dict.ContainsKey("MaturePublish") && dict["MaturePublish"] != null) grec.MaturePublish = bool.Parse(dict["MaturePublish"].ToString()); if (dict.ContainsKey("MembershipFee") && dict["MembershipFee"] != null) grec.MembershipFee = Int32.Parse(dict["MembershipFee"].ToString()); if (dict.ContainsKey("OpenEnrollment") && dict["OpenEnrollment"] != null) grec.OpenEnrollment = bool.Parse(dict["OpenEnrollment"].ToString()); if (dict.ContainsKey("OwnerRoleID") && dict["OwnerRoleID"] != null) grec.OwnerRoleID = UUID.Parse(dict["OwnerRoleID"].ToString()); if (dict.ContainsKey("ServiceLocation") && dict["ServiceLocation"] != null) grec.ServiceLocation = dict["ServiceLocation"].ToString(); else grec.ServiceLocation = string.Empty; if (dict.ContainsKey("ShownInList") && dict["ShownInList"] != null) grec.ShowInList = bool.Parse(dict["ShownInList"].ToString()); if (dict.ContainsKey("MemberCount") && dict["MemberCount"] != null) grec.MemberCount = Int32.Parse(dict["MemberCount"].ToString()); if (dict.ContainsKey("RoleCount") && dict["RoleCount"] != null) grec.RoleCount = Int32.Parse(dict["RoleCount"].ToString()); return grec; }
public static Dictionary<string, object> GroupRecord(ExtendedGroupRecord grec) { Dictionary<string, object> dict = new Dictionary<string, object>(); if (grec == null) return dict; dict["AllowPublish"] = grec.AllowPublish.ToString(); dict["Charter"] = Sanitize(grec.Charter); dict["FounderID"] = grec.FounderID.ToString(); dict["FounderUUI"] = Sanitize(grec.FounderUUI); dict["GroupID"] = grec.GroupID.ToString(); dict["GroupName"] = Sanitize(grec.GroupName); dict["InsigniaID"] = grec.GroupPicture.ToString(); dict["MaturePublish"] = grec.MaturePublish.ToString(); dict["MembershipFee"] = grec.MembershipFee.ToString(); dict["OpenEnrollment"] = grec.OpenEnrollment.ToString(); dict["OwnerRoleID"] = grec.OwnerRoleID.ToString(); dict["ServiceLocation"] = Sanitize(grec.ServiceLocation); dict["ShownInList"] = grec.ShowInList.ToString(); dict["MemberCount"] = grec.MemberCount.ToString(); dict["RoleCount"] = grec.RoleCount.ToString(); return dict; }
ExtendedGroupRecord _GroupDataToRecord(GroupData data) { if (data == null) return null; ExtendedGroupRecord rec = new ExtendedGroupRecord(); rec.AllowPublish = data.Data["AllowPublish"] == "1" ? true : false; rec.Charter = data.Data["Charter"]; rec.FounderID = new UUID(data.Data["FounderID"]); rec.GroupID = data.GroupID; rec.GroupName = data.Data["Name"]; rec.GroupPicture = new UUID(data.Data["InsigniaID"]); rec.MaturePublish = data.Data["MaturePublish"] == "1" ? true : false; rec.MembershipFee = Int32.Parse(data.Data["MembershipFee"]); rec.OpenEnrollment = data.Data["OpenEnrollment"] == "1" ? true : false; rec.OwnerRoleID = new UUID(data.Data["OwnerRoleID"]); rec.ShowInList = data.Data["ShowInList"] == "1" ? true : false; rec.ServiceLocation = data.Data["Location"]; rec.MemberCount = m_Database.MemberCount(data.GroupID); rec.RoleCount = m_Database.RoleCount(data.GroupID); return rec; }
private void FillFounderUUI(ExtendedGroupRecord grec) { UserAccount account = m_UserAccounts.GetUserAccount(UUID.Zero, grec.FounderID); if (account != null) grec.FounderUUI = Util.UniversalIdentifier(account.PrincipalID, account.FirstName, account.LastName, m_HomeURI); }
public static ExtendedGroupRecord GroupRecord(Dictionary <string, object> dict) { if (dict == null) { return(null); } ExtendedGroupRecord grec = new ExtendedGroupRecord(); if (dict.ContainsKey("AllowPublish") && dict["AllowPublish"] != null) { grec.AllowPublish = bool.Parse(dict["AllowPublish"].ToString()); } if (dict.ContainsKey("Charter") && dict["Charter"] != null) { grec.Charter = dict["Charter"].ToString(); } else { grec.Charter = string.Empty; } if (dict.ContainsKey("FounderID") && dict["FounderID"] != null) { grec.FounderID = UUID.Parse(dict["FounderID"].ToString()); } if (dict.ContainsKey("FounderUUI") && dict["FounderUUI"] != null) { grec.FounderUUI = dict["FounderUUI"].ToString(); } else { grec.FounderUUI = string.Empty; } if (dict.ContainsKey("GroupID") && dict["GroupID"] != null) { grec.GroupID = UUID.Parse(dict["GroupID"].ToString()); } if (dict.ContainsKey("GroupName") && dict["GroupName"] != null) { grec.GroupName = dict["GroupName"].ToString(); } else { grec.GroupName = string.Empty; } if (dict.ContainsKey("InsigniaID") && dict["InsigniaID"] != null) { grec.GroupPicture = UUID.Parse(dict["InsigniaID"].ToString()); } if (dict.ContainsKey("MaturePublish") && dict["MaturePublish"] != null) { grec.MaturePublish = bool.Parse(dict["MaturePublish"].ToString()); } if (dict.ContainsKey("MembershipFee") && dict["MembershipFee"] != null) { grec.MembershipFee = Int32.Parse(dict["MembershipFee"].ToString()); } if (dict.ContainsKey("OpenEnrollment") && dict["OpenEnrollment"] != null) { grec.OpenEnrollment = bool.Parse(dict["OpenEnrollment"].ToString()); } if (dict.ContainsKey("OwnerRoleID") && dict["OwnerRoleID"] != null) { grec.OwnerRoleID = UUID.Parse(dict["OwnerRoleID"].ToString()); } if (dict.ContainsKey("ServiceLocation") && dict["ServiceLocation"] != null) { grec.ServiceLocation = dict["ServiceLocation"].ToString(); } else { grec.GroupName = string.Empty; } if (dict.ContainsKey("ShownInList") && dict["ShownInList"] != null) { grec.ShowInList = bool.Parse(dict["ShownInList"].ToString()); } if (dict.ContainsKey("MemberCount") && dict["MemberCount"] != null) { grec.MemberCount = Int32.Parse(dict["MemberCount"].ToString()); } if (dict.ContainsKey("RoleCount") && dict["RoleCount"] != null) { grec.RoleCount = Int32.Parse(dict["RoleCount"].ToString()); } return(grec); }
public ExtendedGroupRecord UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) { ExtendedGroupRecord rec = new ExtendedGroupRecord(); rec.AllowPublish = allowPublish; rec.Charter = charter; rec.GroupPicture = insigniaID; rec.MaturePublish = maturePublish; rec.GroupID = groupID; rec.MembershipFee = membershipFee; rec.OpenEnrollment = openEnrollment; rec.ShowInList = showInList; Dictionary<string, object> sendData = GroupsDataUtils.GroupRecord(rec); sendData["RequestingAgentID"] = RequestingAgentID; sendData["OP"] = "UPDATE"; Dictionary<string, object> ret = MakeRequest("PUTGROUP", sendData); if (ret == null || (ret != null && (!ret.ContainsKey("RESULT") || ret["RESULT"].ToString() == "NULL"))) return null; return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]); }