コード例 #1
0
        public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
        {
            if (GroupID == UUID.Zero && (GroupName == null || (GroupName != null && GroupName == string.Empty)))
            {
                return(null);
            }

            Dictionary <string, object> sendData = new Dictionary <string, object>();

            if (GroupID != UUID.Zero)
            {
                sendData["GroupID"] = GroupID.ToString();
            }
            if (!string.IsNullOrEmpty(GroupName))
            {
                sendData["Name"] = GroupsDataUtils.Sanitize(GroupName);
            }

            sendData["RequestingAgentID"] = RequestingAgentID;

            Dictionary <string, object> ret = MakeRequest("GETGROUP", sendData);

            if (ret == null || (ret != null && (!ret.ContainsKey("RESULT") || ret["RESULT"].ToString() == "NULL")))
            {
                return(null);
            }

            return(GroupsDataUtils.GroupRecord((Dictionary <string, object>)ret["RESULT"]));
        }
コード例 #2
0
        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"]));
        }
コード例 #3
0
        public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["NoticeID"]          = noticeID.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;

            Dictionary <string, object> ret = MakeRequest("GETNOTICES", sendData);

            if (ret == null)
            {
                return(null);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(null);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(null);
            }

            return(GroupsDataUtils.GroupNoticeInfo((Dictionary <string, object>)ret["RESULT"]));
        }
コード例 #4
0
        byte[] HandleFindGroups(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("Query"))
            {
                NullResult(result, "Bad network data");
            }

            List <DirGroupsReplyData> hits = m_GroupsService.FindGroups(request["RequestingAgentID"].ToString(), request["Query"].ToString());

            if (hits == null || (hits != null && hits.Count == 0))
            {
                NullResult(result, "No hits");
            }
            else
            {
                Dictionary <string, object> dict = new Dictionary <string, object>();
                int i = 0;
                foreach (DirGroupsReplyData n in hits)
                {
                    dict["n-" + i++] = GroupsDataUtils.DirGroupsReplyData(n);
                }

                result["RESULT"] = dict;
            }


            string xmlString = ServerUtils.BuildXmlResponse(result);

            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }
コード例 #5
0
        public GroupMembershipData AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
        {
            reason = string.Empty;

            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["AgentID"]           = AgentID;
            sendData["GroupID"]           = GroupID.ToString();
            sendData["RoleID"]            = RoleID.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;
            sendData["AccessToken"]       = token;
            Dictionary <string, object> ret = MakeRequest("ADDAGENTTOGROUP", sendData);

            if (ret == null)
            {
                return(null);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(null);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                reason = ret["REASON"].ToString();
                return(null);
            }

            return(GroupsDataUtils.GroupMembershipData((Dictionary <string, object>)ret["RESULT"]));
        }
コード例 #6
0
        public GroupInviteInfo GetAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["InviteID"]          = inviteID.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;
            sendData["OP"] = "GET";

            Dictionary <string, object> ret = MakeRequest("INVITE", sendData);

            if (ret == null)
            {
                return(null);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(null);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(null);
            }

            return(GroupsDataUtils.GroupInviteInfo((Dictionary <string, object>)ret["RESULT"]));
        }
コード例 #7
0
        public List <ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID)
        {
            List <ExtendedGroupNoticeData> notices = new List <ExtendedGroupNoticeData>();

            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["GroupID"]           = GroupID.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;
            Dictionary <string, object> ret = MakeRequest("GETNOTICES", sendData);

            if (ret == null)
            {
                return(notices);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(notices);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(notices);
            }

            foreach (object v in ((Dictionary <string, object>)ret["RESULT"]).Values)
            {
                ExtendedGroupNoticeData m = GroupsDataUtils.GroupNoticeData((Dictionary <string, object>)v);
                notices.Add(m);
            }

            return(notices);
        }
コード例 #8
0
        public List <GroupRolesData> GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID)
        {
            List <GroupRolesData> roles = new List <GroupRolesData>();

            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["AgentID"]           = AgentID.ToString();
            sendData["GroupID"]           = GroupID.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;
            Dictionary <string, object> ret = MakeRequest("GETAGENTROLES", sendData);

            if (ret == null)
            {
                return(roles);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(roles);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(roles);
            }

            foreach (object v in ((Dictionary <string, object>)ret["RESULT"]).Values)
            {
                GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary <string, object>)v);
                roles.Add(m);
            }

            return(roles);
        }
コード例 #9
0
        public GroupMembershipData SetAgentActiveGroup(string RequestingAgentID, string AgentID, UUID GroupID)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["AgentID"]           = AgentID.ToString();
            sendData["GroupID"]           = GroupID.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;
            sendData["OP"] = "GROUP";

            Dictionary <string, object> ret = MakeRequest("SETACTIVE", sendData);

            if (ret == null)
            {
                return(null);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(null);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(null);
            }

            return(GroupsDataUtils.GroupMembershipData((Dictionary <string, object>)ret["RESULT"]));
        }
コード例 #10
0
        public bool UpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["GroupID"]           = groupID.ToString();
            sendData["RoleID"]            = roleID.ToString();
            sendData["Name"]              = GroupsDataUtils.Sanitize(name);
            sendData["Description"]       = GroupsDataUtils.Sanitize(description);
            sendData["Title"]             = GroupsDataUtils.Sanitize(title);
            sendData["Powers"]            = powers.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;
            sendData["OP"] = "UPDATE";
            Dictionary <string, object> ret = MakeRequest("PUTROLE", sendData);

            if (ret == null)
            {
                return(false);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(false);
            }

            if (ret["RESULT"].ToString().ToLower() != "true")
            {
                return(false);
            }

            return(true);
        }
コード例 #11
0
        public List <GroupMembershipData> GetMemberships(string RequestingAgentID, string AgentID)
        {
            List <GroupMembershipData> memberships = new List <GroupMembershipData>();

            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["AgentID"]           = AgentID;
            sendData["ALL"]               = "true";
            sendData["RequestingAgentID"] = RequestingAgentID;
            Dictionary <string, object> ret = MakeRequest("GETMEMBERSHIP", sendData);

            if (ret == null)
            {
                return(memberships);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(memberships);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(memberships);
            }

            foreach (object v in ((Dictionary <string, object>)ret["RESULT"]).Values)
            {
                GroupMembershipData m = GroupsDataUtils.GroupMembershipData((Dictionary <string, object>)v);
                memberships.Add(m);
            }

            return(memberships);
        }
コード例 #12
0
        public ExtendedGroupMembershipData GetMembership(string RequestingAgentID, string AgentID, UUID GroupID)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["AgentID"] = AgentID;
            if (GroupID != UUID.Zero)
            {
                sendData["GroupID"] = GroupID.ToString();
            }
            sendData["RequestingAgentID"] = RequestingAgentID;
            Dictionary <string, object> ret = MakeRequest("GETMEMBERSHIP", sendData);

            if (ret == null)
            {
                return(null);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(null);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(null);
            }

            return(GroupsDataUtils.GroupMembershipData((Dictionary <string, object>)ret["RESULT"]));
        }
コード例 #13
0
        public List <ExtendedGroupRoleMembersData> GetGroupRoleMembers(string RequestingAgentID, UUID GroupID, string token)
        {
            List <ExtendedGroupRoleMembersData> rmembers = new List <ExtendedGroupRoleMembersData>();

            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["GroupID"]           = GroupID.ToString();
            sendData["RequestingAgentID"] = RequestingAgentID;
            sendData["AccessToken"]       = GroupsDataUtils.Sanitize(token);
            Dictionary <string, object> ret = MakeRequest("GETROLEMEMBERS", sendData);

            if (ret == null)
            {
                return(rmembers);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(rmembers);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(rmembers);
            }

            foreach (object v in ((Dictionary <string, object>)ret["RESULT"]).Values)
            {
                ExtendedGroupRoleMembersData m = GroupsDataUtils.GroupRoleMembersData((Dictionary <string, object>)v);
                rmembers.Add(m);
            }

            return(rmembers);
        }
コード例 #14
0
        public void RemoveAgentFromGroup(string AgentID, UUID GroupID, string token)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["AgentID"]     = AgentID;
            sendData["GroupID"]     = GroupID.ToString();
            sendData["AccessToken"] = GroupsDataUtils.Sanitize(token);
            MakeRequest("REMOVEAGENTFROMGROUP", sendData);
        }
コード例 #15
0
        byte[] HandleGetNotices(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (!request.ContainsKey("RequestingAgentID"))
            {
                NullResult(result, "Bad network data");
            }

            else if (request.ContainsKey("NoticeID")) // just one
            {
                GroupNoticeInfo notice = m_GroupsService.GetGroupNotice(request["RequestingAgentID"].ToString(), new UUID(request["NoticeID"].ToString()));

                if (notice == null)
                {
                    NullResult(result, "NO such notice");
                }
                else
                {
                    result["RESULT"] = GroupsDataUtils.GroupNoticeInfo(notice);
                }
            }
            else if (request.ContainsKey("GroupID")) // all notices for group
            {
                List <ExtendedGroupNoticeData> notices = m_GroupsService.GetGroupNotices(request["RequestingAgentID"].ToString(), new UUID(request["GroupID"].ToString()));

                if (notices == null || (notices != null && notices.Count == 0))
                {
                    NullResult(result, "No notices");
                }
                else
                {
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    int i = 0;
                    foreach (ExtendedGroupNoticeData n in notices)
                    {
                        dict["n-" + i++] = GroupsDataUtils.GroupNoticeData(n);
                    }

                    result["RESULT"] = dict;
                }
            }
            else
            {
                NullResult(result, "Bad OP in request");
            }

            string xmlString = ServerUtils.BuildXmlResponse(result);

            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }
コード例 #16
0
        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)));
            }
        }
コード例 #17
0
        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));
        }
コード例 #18
0
        byte[] HandleAddAgentToGroup(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("AgentID") ||
                !request.ContainsKey("GroupID") || !request.ContainsKey("RoleID"))
            {
                NullResult(result, "Bad network data");
            }
            else
            {
                UUID   groupID           = new UUID(request["GroupID"].ToString());
                UUID   roleID            = new UUID(request["RoleID"].ToString());
                string agentID           = request["AgentID"].ToString();
                string requestingAgentID = request["RequestingAgentID"].ToString();
                string token             = string.Empty;
                string reason            = string.Empty;

                if (request.ContainsKey("AccessToken"))
                {
                    token = request["AccessToken"].ToString();
                }

                if (!m_GroupsService.AddAgentToGroup(requestingAgentID, agentID, groupID, roleID, token, out reason))
                {
                    NullResult(result, reason);
                }
                else
                {
                    GroupMembershipData membership = m_GroupsService.GetAgentGroupMembership(requestingAgentID, agentID, groupID);
                    if (membership == null)
                    {
                        NullResult(result, "Internal error");
                    }
                    else
                    {
                        result["RESULT"] = GroupsDataUtils.GroupMembershipData((ExtendedGroupMembershipData)membership);
                    }
                }
            }

            string xmlString = ServerUtils.BuildXmlResponse(result);

            //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }
コード例 #19
0
        byte[] HandleSetActive(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") ||
                !request.ContainsKey("AgentID") || !request.ContainsKey("OP"))
            {
                NullResult(result, "Bad network data");
                string xmlString = ServerUtils.BuildXmlResponse(result);
                return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
            }
            else
            {
                string op = request["OP"].ToString();

                if (op == "GROUP")
                {
                    ExtendedGroupMembershipData group = m_GroupsService.SetAgentActiveGroup(request["RequestingAgentID"].ToString(),
                                                                                            request["AgentID"].ToString(), new UUID(request["GroupID"].ToString()));

                    if (group == null)
                    {
                        NullResult(result, "Internal error");
                    }
                    else
                    {
                        result["RESULT"] = GroupsDataUtils.GroupMembershipData(group);
                    }

                    string xmlString = ServerUtils.BuildXmlResponse(result);

                    //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
                    return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
                }
                else if (op == "ROLE" && request.ContainsKey("RoleID"))
                {
                    m_GroupsService.SetAgentActiveGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(),
                                                            new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString()));
                    result["RESULT"] = "true";
                }

                return(Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result)));
            }
        }
コード例 #20
0
        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));
        }
コード例 #21
0
        public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
                                   bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["GroupID"]       = groupID.ToString();
            sendData["NoticeID"]      = noticeID.ToString();
            sendData["FromName"]      = GroupsDataUtils.Sanitize(fromName);
            sendData["Subject"]       = GroupsDataUtils.Sanitize(subject);
            sendData["Message"]       = GroupsDataUtils.Sanitize(message);
            sendData["HasAttachment"] = hasAttachment.ToString();
            if (hasAttachment)
            {
                sendData["AttachmentType"]    = attType.ToString();
                sendData["AttachmentName"]    = attName.ToString();
                sendData["AttachmentItemID"]  = attItemID.ToString();
                sendData["AttachmentOwnerID"] = attOwnerID;
            }
            sendData["RequestingAgentID"] = RequestingAgentID;

            Dictionary <string, object> ret = MakeRequest("ADDNOTICE", sendData);

            if (ret == null)
            {
                return(false);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(false);
            }

            if (ret["RESULT"].ToString().ToLower() != "true")
            {
                return(false);
            }

            return(true);
        }
コード例 #22
0
        public List <DirGroupsReplyData> FindGroups(string RequestingAgentID, string query)
        {
            List <DirGroupsReplyData> hits = new List <DirGroupsReplyData>();

            if (string.IsNullOrEmpty(query))
            {
                return(hits);
            }

            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["Query"]             = query;
            sendData["RequestingAgentID"] = RequestingAgentID;

            Dictionary <string, object> ret = MakeRequest("FINDGROUPS", sendData);

            if (ret == null)
            {
                return(hits);
            }

            if (!ret.ContainsKey("RESULT"))
            {
                return(hits);
            }

            if (ret["RESULT"].ToString() == "NULL")
            {
                return(hits);
            }

            foreach (object v in ((Dictionary <string, object>)ret["RESULT"]).Values)
            {
                DirGroupsReplyData m = GroupsDataUtils.DirGroupsReplyData((Dictionary <string, object>)v);
                hits.Add(m);
            }

            return(hits);
        }
コード例 #23
0
        byte[] HandleGetGroupMembers(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("AccessToken"))
            {
                NullResult(result, "Bad network data");
            }
            else
            {
                UUID   groupID           = new UUID(request["GroupID"].ToString());
                string requestingAgentID = request["RequestingAgentID"].ToString();
                string token             = request["AccessToken"].ToString();

                List <ExtendedGroupMembersData> members = m_GroupsService.GetGroupMembers(requestingAgentID, groupID, token);
                if (members == null || (members != null && members.Count == 0))
                {
                    NullResult(result, "No members");
                }
                else
                {
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    int i = 0;
                    foreach (ExtendedGroupMembersData m in members)
                    {
                        dict["m-" + i++] = GroupsDataUtils.GroupMembersData(m);
                    }

                    result["RESULT"] = dict;
                }
            }

            string xmlString = ServerUtils.BuildXmlResponse(result);

            //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }
コード例 #24
0
        byte[] HandleGetAgentRoles(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("AgentID"))
            {
                NullResult(result, "Bad network data");
            }
            else
            {
                UUID   groupID           = new UUID(request["GroupID"].ToString());
                string agentID           = request["AgentID"].ToString();
                string requestingAgentID = request["RequestingAgentID"].ToString();

                List <GroupRolesData> roles = m_GroupsService.GetAgentGroupRoles(requestingAgentID, agentID, groupID);
                if (roles == null || (roles != null && roles.Count == 0))
                {
                    NullResult(result, "No members");
                }
                else
                {
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    int i = 0;
                    foreach (GroupRolesData r in roles)
                    {
                        dict["r-" + i++] = GroupsDataUtils.GroupRolesData(r);
                    }

                    result["RESULT"] = dict;
                }
            }

            string xmlString = ServerUtils.BuildXmlResponse(result);

            //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }
コード例 #25
0
        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"]));
        }
コード例 #26
0
        byte[] HandleGetMembership(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("AgentID"))
            {
                NullResult(result, "Bad network data");
            }
            else
            {
                string agentID = request["AgentID"].ToString();
                UUID   groupID = UUID.Zero;
                if (request.ContainsKey("GroupID"))
                {
                    groupID = new UUID(request["GroupID"].ToString());
                }
                string requestingAgentID = request["RequestingAgentID"].ToString();
                bool   all = request.ContainsKey("ALL");

                if (!all)
                {
                    ExtendedGroupMembershipData membership = null;
                    if (groupID == UUID.Zero)
                    {
                        membership = m_GroupsService.GetAgentActiveMembership(requestingAgentID, agentID);
                    }
                    else
                    {
                        membership = m_GroupsService.GetAgentGroupMembership(requestingAgentID, agentID, groupID);
                    }

                    if (membership == null)
                    {
                        NullResult(result, "No such membership");
                    }
                    else
                    {
                        result["RESULT"] = GroupsDataUtils.GroupMembershipData(membership);
                    }
                }
                else
                {
                    List <GroupMembershipData> memberships = m_GroupsService.GetAgentGroupMemberships(requestingAgentID, agentID);
                    if (memberships == null || (memberships != null && memberships.Count == 0))
                    {
                        NullResult(result, "No memberships");
                    }
                    else
                    {
                        Dictionary <string, object> dict = new Dictionary <string, object>();
                        int i = 0;
                        foreach (GroupMembershipData m in memberships)
                        {
                            dict["m-" + i++] = GroupsDataUtils.GroupMembershipData((ExtendedGroupMembershipData)m);
                        }

                        result["RESULT"] = dict;
                    }
                }
            }

            string xmlString = ServerUtils.BuildXmlResponse(result);

            //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }