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);
        }
        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"]));
        }
        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);
        }
        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);
        }
        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);
        }