public void GroupMembershipData(UUID AgentID, GroupMembershipData[] data)
        {
            StringBuilder sb = StartEvent("AgentGroupDataUpdate");

            LLSDxmlEncode.AddArrayAndMap("AgentData", sb);
            LLSDxmlEncode.AddElem("AgentID", AgentID, sb);
            LLSDxmlEncode.AddEndMapAndArray(sb);

            if (data.Length == 0)
            {
                LLSDxmlEncode.AddEmptyArray("GroupData", sb);
                LLSDxmlEncode.AddEmptyArray("NewGroupData", sb);
            }
            else
            {
                List <bool> lstInProfiles = new List <bool>(data.Length);
                LLSDxmlEncode.AddArray("GroupData", sb);
                foreach (GroupMembershipData m in data)
                {
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("GroupID", m.GroupID, sb);
                    LLSDxmlEncode.AddElem("GroupPowers", m.GroupPowers, sb);
                    LLSDxmlEncode.AddElem("AcceptNotices", m.AcceptNotices, sb);
                    LLSDxmlEncode.AddElem("GroupInsigniaID", m.GroupPicture, sb);
                    LLSDxmlEncode.AddElem("Contribution", m.Contribution, sb);
                    LLSDxmlEncode.AddElem("GroupName", m.GroupName, sb);
                    LLSDxmlEncode.AddEndMap(sb);
                    lstInProfiles.Add(m.ListInProfile);
                }
                LLSDxmlEncode.AddEndArray(sb);

                LLSDxmlEncode.AddArray("NewGroupData", sb);
                foreach (bool b in lstInProfiles)
                {
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("ListInProfile", b, sb);
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }

            OSD ev = new OSDllsdxml(EndEvent(sb));

            Enqueue(ev, AgentID);
        }
예제 #2
0
        public void ProcessRequest(IOSHttpRequest request, IOSHttpResponse response, UUID AgentId)
        {
            if (request.HttpMethod != "GET")
            {
                response.StatusCode = (int)HttpStatusCode.NotFound;
                return;
            }

            ScenePresence avatar;

            if (!m_scene.TryGetScenePresence(AgentId, out avatar) || m_scene.RegionInfo == null || m_scene.RegionInfo.EstateSettings == null)
            {
                response.StatusCode = (int)HttpStatusCode.Gone;
                return;
            }

            if (!m_scene.Permissions.CanIssueEstateCommand(AgentId, false))
            {
                response.StatusCode = (int)HttpStatusCode.Unauthorized;
                return;
            }

            EstateSettings regionSettings = m_scene.RegionInfo.EstateSettings;

            UUID[]      managers   = regionSettings.EstateManagers;
            UUID[]      allowed    = regionSettings.EstateAccess;
            UUID[]      groups     = regionSettings.EstateGroups;
            EstateBan[] EstateBans = regionSettings.EstateBans;

            StringBuilder sb = LLSDxmlEncode.Start();

            LLSDxmlEncode.AddMap(sb);

            if (allowed != null && allowed.Length > 0)
            {
                LLSDxmlEncode.AddArray("AllowedAgents", sb);
                for (int i = 0; i < allowed.Length; ++i)
                {
                    UUID id = allowed[i];
                    if (id == UUID.Zero)
                    {
                        continue;
                    }
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("id", id, sb);
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }
            else
            {
                LLSDxmlEncode.AddEmptyArray("AllowedAgents", sb);
            }

            if (groups != null && groups.Length > 0)
            {
                LLSDxmlEncode.AddArray("AllowedGroups", sb);
                for (int i = 0; i < groups.Length; ++i)
                {
                    UUID id = groups[i];
                    if (id == UUID.Zero)
                    {
                        continue;
                    }
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("id", id, sb);
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }
            else
            {
                LLSDxmlEncode.AddEmptyArray("AllowedGroups", sb);
            }

            if (EstateBans != null && EstateBans.Length > 0)
            {
                LLSDxmlEncode.AddArray("BannedAgents", sb);
                for (int i = 0; i < EstateBans.Length; ++i)
                {
                    EstateBan ban = EstateBans[i];
                    UUID      id  = ban.BannedUserID;
                    if (id == UUID.Zero)
                    {
                        continue;
                    }
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("id", id, sb);
                    LLSDxmlEncode.AddElem("banning_id", ban.BanningUserID, sb);
                    LLSDxmlEncode.AddElem("last_login_date", "na", sb); // We will not have this. This information is far at grid
                    if (ban.BanTime == 0)
                    {
                        LLSDxmlEncode.AddElem("ban_date", "0000-00-00 00:00", sb);
                    }
                    else
                    {
                        LLSDxmlEncode.AddElem("ban_date", (Util.ToDateTime(ban.BanTime)).ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture), sb);
                    }
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }
            else
            {
                LLSDxmlEncode.AddEmptyArray("BannedAgents", sb);
            }

            if (managers != null && managers.Length > 0)
            {
                LLSDxmlEncode.AddArray("Managers", sb);
                for (int i = 0; i < managers.Length; ++i)
                {
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("agent_id", managers[i], sb);
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }
            else
            {
                LLSDxmlEncode.AddEmptyArray("Managers", sb);
            }

            LLSDxmlEncode.AddEndMap(sb);

            response.RawBuffer  = Util.UTF8.GetBytes(LLSDxmlEncode.End(sb));
            response.StatusCode = (int)HttpStatusCode.OK;
        }
예제 #3
0
        public void FetchInventoryDescendentsRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, ExpiringKey <UUID> BadRequests)
        {
            //m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request);

            List <LLSDFetchInventoryDescendents> folders = null;
            List <UUID> bad_folders = new List <UUID>();

            try
            {
                OSDArray foldersrequested = null;
                OSD      tmp = OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
                httpRequest.InputStream.Dispose();

                OSDMap map = (OSDMap)tmp;
                if (map.TryGetValue("folders", out tmp) && tmp is OSDArray)
                {
                    foldersrequested = tmp as OSDArray;
                }

                if (foldersrequested == null || foldersrequested.Count == 0)
                {
                    httpResponse.RawBuffer = EmptyResponse;
                    return;
                }

                folders = new List <LLSDFetchInventoryDescendents>(foldersrequested.Count);
                for (int i = 0; i < foldersrequested.Count; i++)
                {
                    OSDMap mfolder = foldersrequested[i] as OSDMap;
                    UUID   id      = mfolder["folder_id"].AsUUID();
                    if (BadRequests.ContainsKey(id))
                    {
                        bad_folders.Add(id);
                    }
                    else
                    {
                        LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
                        try
                        {
                            llsdRequest.folder_id     = id;
                            llsdRequest.owner_id      = mfolder["owner_id"].AsUUID();
                            llsdRequest.sort_order    = mfolder["sort_order"].AsInteger();
                            llsdRequest.fetch_folders = mfolder["fetch_folders"].AsBoolean();
                            llsdRequest.fetch_items   = mfolder["fetch_items"].AsBoolean();
                        }
                        catch (Exception e)
                        {
                            m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e.Message);
                            continue;
                        }
                        folders.Add(llsdRequest);
                    }
                }
                foldersrequested = null;
                map.Clear();
                map = null;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[FETCH INV DESC]: fail parsing request: {0}", e.Message);
                httpResponse.RawBuffer = EmptyResponse;
                return;
            }

            if (folders == null || folders.Count == 0)
            {
                if (bad_folders.Count == 0)
                {
                    httpResponse.RawBuffer = EmptyResponse;
                    return;
                }

                StringBuilder sb = osStringBuilderCache.Acquire();
                sb.Append("[WEB FETCH INV DESC HANDLER]: Unable to fetch folders owned by ");
                sb.Append("Unknown");
                sb.Append(" :");
                int limit = 5;
                int count = 0;
                foreach (UUID bad in bad_folders)
                {
                    if (BadRequests.ContainsKey(bad))
                    {
                        continue;
                    }
                    sb.Append(" ");
                    sb.Append(bad.ToString());
                    ++count;
                    if (--limit < 0)
                    {
                        break;
                    }
                }

                if (count > 0)
                {
                    if (limit < 0)
                    {
                        sb.Append(" ...");
                    }
                    m_log.Warn(osStringBuilderCache.GetStringAndRelease(sb));
                }
                else
                {
                    osStringBuilderCache.Release(sb);
                }

                sb = osStringBuilderCache.Acquire();
                sb.Append("<llsd><map><key>folders</key><array /></map><map><key>bad_folders</key><array>");
                foreach (UUID bad in bad_folders)
                {
                    sb.Append("<map><key>folder_id</key><uuid>");
                    sb.Append(bad.ToString());
                    sb.Append("</uuid><key>error</key><string>Unknown</string></map>");
                }
                sb.Append("</array></map></llsd>");
                httpResponse.RawBuffer = Util.UTF8NBGetbytes(osStringBuilderCache.GetStringAndRelease(sb));
                return;
            }

            int total_folders = 0;
            int total_items   = 0;

            UUID requester = folders[0].owner_id;

            List <InventoryCollection> invcollSet = Fetch(folders, bad_folders, ref total_folders, ref total_items);
            //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count);

            int invcollSetCount = 0;

            if (invcollSet != null)
            {
                invcollSetCount = invcollSet.Count;
            }

            int mem = 8192 + ((256 * invcollSetCount +
                               384 * total_folders +
                               1024 * total_items +
                               128 * bad_folders.Count) & 0x7ffff000);

            StringBuilder lastresponse = new StringBuilder(mem);

            lastresponse.Append("<llsd>");

            if (invcollSetCount > 0)
            {
                lastresponse.Append("<map><key>folders</key><array>");
                int i = 0;
                InventoryCollection thiscoll;
                for (i = 0; i < invcollSetCount; i++)
                {
                    thiscoll      = invcollSet[i];
                    invcollSet[i] = null;

                    LLSDxmlEncode.AddMap(lastresponse);
                    LLSDxmlEncode.AddElem("agent_id", thiscoll.OwnerID, lastresponse);
                    LLSDxmlEncode.AddElem("descendents", thiscoll.Descendents, lastresponse);
                    LLSDxmlEncode.AddElem("folder_id", thiscoll.FolderID, lastresponse);

                    if (thiscoll.Folders == null || thiscoll.Folders.Count == 0)
                    {
                        LLSDxmlEncode.AddEmptyArray("categories", lastresponse);
                    }
                    else
                    {
                        LLSDxmlEncode.AddArray("categories", lastresponse);
                        foreach (InventoryFolderBase invFolder in thiscoll.Folders)
                        {
                            LLSDxmlEncode.AddMap(lastresponse);

                            LLSDxmlEncode.AddElem("folder_id", invFolder.ID, lastresponse);
                            LLSDxmlEncode.AddElem("parent_id", invFolder.ParentID, lastresponse);
                            LLSDxmlEncode.AddElem("name", invFolder.Name, lastresponse);
                            LLSDxmlEncode.AddElem("type", invFolder.Type, lastresponse);
                            LLSDxmlEncode.AddElem("preferred_type", (int)-1, lastresponse);
                            LLSDxmlEncode.AddElem("version", invFolder.Version, lastresponse);

                            LLSDxmlEncode.AddEndMap(lastresponse);
                        }
                        LLSDxmlEncode.AddEndArray(lastresponse);
                    }

                    if (thiscoll.Items == null || thiscoll.Items.Count == 0)
                    {
                        LLSDxmlEncode.AddEmptyArray("items", lastresponse);
                    }
                    else
                    {
                        LLSDxmlEncode.AddArray("items", lastresponse);
                        foreach (InventoryItemBase invItem in thiscoll.Items)
                        {
                            invItem.ToLLSDxml(lastresponse);
                        }

                        LLSDxmlEncode.AddEndArray(lastresponse);
                    }

                    LLSDxmlEncode.AddElem("owner_id", thiscoll.OwnerID, lastresponse);
                    LLSDxmlEncode.AddElem("version", thiscoll.Version, lastresponse);

                    LLSDxmlEncode.AddEndMap(lastresponse);
                    invcollSet[i] = null;
                }
                lastresponse.Append("</array></map>");
                thiscoll = null;
            }
            else
            {
                lastresponse.Append("<map><key>folders</key><array /></map>");
            }

            if (bad_folders.Count > 0)
            {
                lastresponse.Append("<map><key>bad_folders</key><array>");
                foreach (UUID bad in bad_folders)
                {
                    BadRequests.Add(bad);
                    lastresponse.Append("<map><key>folder_id</key><uuid>");
                    lastresponse.Append(bad.ToString());
                    lastresponse.Append("</uuid><key>error</key><string>Unknown</string></map>");
                }
                lastresponse.Append("</array></map>");

                StringBuilder sb = osStringBuilderCache.Acquire();
                sb.Append("[WEB FETCH INV DESC HANDLER]: Unable to fetch folders owned by ");
                sb.Append(requester.ToString());
                sb.Append(" :");
                int limit = 9;
                foreach (UUID bad in bad_folders)
                {
                    sb.Append(" ");
                    sb.Append(bad.ToString());
                    if (--limit < 0)
                    {
                        break;
                    }
                }
                if (limit < 0)
                {
                    sb.Append(" ...");
                }
                m_log.Warn(osStringBuilderCache.GetStringAndRelease(sb));
            }
            lastresponse.Append("</llsd>");

            httpResponse.RawBuffer = Util.UTF8NBGetbytes(lastresponse.ToString());
        }
예제 #4
0
        public string FetchInventoryRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            //m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request);

            OSDMap   requestmap     = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
            OSDArray itemsRequested = (OSDArray)requestmap["items"];

            UUID[] itemIDs = new UUID[itemsRequested.Count];
            int    i       = 0;

            foreach (OSDMap osdItemId in itemsRequested)
            {
                itemIDs[i++] = osdItemId["item_id"].AsUUID();
            }

            InventoryItemBase[] items = null;

            if (m_agentID != UUID.Zero)
            {
                items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
            }
            else
            {
                items = new InventoryItemBase[itemsRequested.Count];
                foreach (UUID id in itemIDs)
                {
                    items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
                }
            }

            StringBuilder lsl = LLSDxmlEncode.Start(4096);

            LLSDxmlEncode.AddMap(lsl);

            if (m_agentID == UUID.Zero && items.Length > 0)
            {
                LLSDxmlEncode.AddElem("agent_id", items[0].Owner, lsl);
            }
            else
            {
                LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
            }

            if (items == null || items.Length == 0)
            {
                LLSDxmlEncode.AddEmptyArray("items", lsl);
            }
            else
            {
                LLSDxmlEncode.AddArray("items", lsl);
                foreach (InventoryItemBase item in items)
                {
                    if (item != null)
                    {
                        item.ToLLSDxml(lsl, 0xff);
                    }
                }
                LLSDxmlEncode.AddEndArray(lsl);
            }

            LLSDxmlEncode.AddEndMap(lsl);
            return(LLSDxmlEncode.End(lsl));;
        }
예제 #5
0
        public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            //m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request);

            ArrayList foldersrequested = null;

            try
            {
                Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
                foldersrequested = (ArrayList)hash["folders"];
                hash             = null;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[FETCH INV DESC]: fail parsing request: '{0}'; path: '{1}'; exception: '{2}'", request, path, e.Message);
                foldersrequested = null;
            }

            if (foldersrequested == null || foldersrequested.Count == 0)
            {
                return("<llsd><map><key>folders</key><array /></map></llsd>");
            }

            List <LLSDFetchInventoryDescendents> folders = new List <LLSDFetchInventoryDescendents>();

            for (int i = 0; i < foldersrequested.Count; i++)
            {
                Hashtable inventoryhash = (Hashtable)foldersrequested[i];
                LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();

                try
                {
                    LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest);
                }
                catch (Exception e)
                {
                    m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e.Message);
                    continue;
                }

                folders.Add(llsdRequest);
            }

            foldersrequested.Clear();

            if (folders.Count == 0)
            {
                return("<llsd><map><key>folders</key><array /></map></llsd>");
            }

            List <UUID> bad_folders = new List <UUID>();

            int total_folders = 0;
            int total_items   = 0;
            List <InventoryCollection> invcollSet = Fetch(folders, bad_folders, ref total_folders, ref total_items);
            //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count);

            int invcollSetCount = 0;

            if (invcollSet != null)
            {
                invcollSetCount = invcollSet.Count;
            }

            int mem = 8192 + ((256 * invcollSetCount +
                               384 * total_folders +
                               1024 * total_items +
                               128 * bad_folders.Count) & 0x7ffff000);

            StringBuilder lastresponse = new StringBuilder(mem);

            lastresponse.Append("<llsd>");

            if (invcollSetCount > 0)
            {
                lastresponse.Append("<map><key>folders</key><array>");
                int i = 0;
                InventoryCollection thiscoll;
                for (i = 0; i < invcollSetCount; i++)
                {
                    thiscoll      = invcollSet[i];
                    invcollSet[i] = null;

                    LLSDxmlEncode.AddMap(lastresponse);
                    LLSDxmlEncode.AddElem("agent_id", thiscoll.OwnerID, lastresponse);
                    LLSDxmlEncode.AddElem("descendents", thiscoll.Descendents, lastresponse);
                    LLSDxmlEncode.AddElem("folder_id", thiscoll.FolderID, lastresponse);

                    if (thiscoll.Folders == null || thiscoll.Folders.Count == 0)
                    {
                        LLSDxmlEncode.AddEmptyArray("categories", lastresponse);
                    }
                    else
                    {
                        LLSDxmlEncode.AddArray("categories", lastresponse);
                        foreach (InventoryFolderBase invFolder in thiscoll.Folders)
                        {
                            LLSDxmlEncode.AddMap(lastresponse);

                            LLSDxmlEncode.AddElem("folder_id", invFolder.ID, lastresponse);
                            LLSDxmlEncode.AddElem("parent_id", invFolder.ParentID, lastresponse);
                            LLSDxmlEncode.AddElem("name", invFolder.Name, lastresponse);
                            LLSDxmlEncode.AddElem("type", invFolder.Type, lastresponse);
                            LLSDxmlEncode.AddElem("preferred_type", (int)-1, lastresponse);
                            LLSDxmlEncode.AddElem("version", invFolder.Version, lastresponse);

                            LLSDxmlEncode.AddEndMap(lastresponse);
                        }
                        LLSDxmlEncode.AddEndArray(lastresponse);
                    }

                    if (thiscoll.Items == null || thiscoll.Items.Count == 0)
                    {
                        LLSDxmlEncode.AddEmptyArray("items", lastresponse);
                    }
                    else
                    {
                        LLSDxmlEncode.AddArray("items", lastresponse);
                        foreach (InventoryItemBase invItem in thiscoll.Items)
                        {
                            invItem.ToLLSDxml(lastresponse);
                        }

                        LLSDxmlEncode.AddEndArray(lastresponse);
                    }

                    LLSDxmlEncode.AddElem("owner_id", thiscoll.OwnerID, lastresponse);
                    LLSDxmlEncode.AddElem("version", thiscoll.Version, lastresponse);

                    LLSDxmlEncode.AddEndMap(lastresponse);
                    invcollSet[i] = null;
                }
                lastresponse.Append("</array></map>");
                thiscoll = null;
            }
            else
            {
                lastresponse.Append("<map><key>folders</key><array /></map>");
            }

            //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders));
            if (bad_folders.Count > 0)
            {
                lastresponse.Append("<map><key>bad_folders</key><array>");
                foreach (UUID bad in bad_folders)
                {
                    lastresponse.Append("<map><key>folder_id</key><uuid>");
                    lastresponse.Append(bad.ToString());
                    lastresponse.Append("</uuid><key>error</key><string>Unknown</string></map>");
                }
                lastresponse.Append("</array></map>");
            }
            lastresponse.Append("</llsd>");

            return(lastresponse.ToString());
        }
예제 #6
0
        public Hashtable ProcessGetRequest(Hashtable request, UUID AgentId, Caps cap)
        {
            Hashtable responsedata = new Hashtable();

            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"]      = "text/plain";

            ScenePresence avatar;

            if (!m_scene.TryGetScenePresence(AgentId, out avatar))
            {
                responsedata["str_response_string"] = "<llsd><array /></llsd>";;
                responsedata["keepalive"]           = false;
                return(responsedata);
            }

            if (m_scene.RegionInfo == null ||
                m_scene.RegionInfo.EstateSettings == null ||
                !m_scene.Permissions.CanIssueEstateCommand(AgentId, false))
            {
                responsedata["str_response_string"] = "<llsd><array /></llsd>";;
                return(responsedata);
            }

            EstateSettings regionSettings = m_scene.RegionInfo.EstateSettings;

            UUID[]      managers   = regionSettings.EstateManagers;
            UUID[]      allowed    = regionSettings.EstateAccess;
            UUID[]      groups     = regionSettings.EstateGroups;
            EstateBan[] EstateBans = regionSettings.EstateBans;

            StringBuilder sb = LLSDxmlEncode.Start();

            LLSDxmlEncode.AddMap(sb);

            if (allowed != null && allowed.Length > 0)
            {
                LLSDxmlEncode.AddArray("AllowedAgents", sb);
                for (int i = 0; i < allowed.Length; ++i)
                {
                    UUID id = allowed[i];
                    if (id == UUID.Zero)
                    {
                        continue;
                    }
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("id", id, sb);
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }
            else
            {
                LLSDxmlEncode.AddEmptyArray("AllowedAgents", sb);
            }

            if (groups != null && groups.Length > 0)
            {
                LLSDxmlEncode.AddArray("AllowedGroups", sb);
                for (int i = 0; i < groups.Length; ++i)
                {
                    UUID id = groups[i];
                    if (id == UUID.Zero)
                    {
                        continue;
                    }
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("id", id, sb);
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }
            else
            {
                LLSDxmlEncode.AddEmptyArray("AllowedGroups", sb);
            }

            if (EstateBans != null && EstateBans.Length > 0)
            {
                LLSDxmlEncode.AddArray("BannedAgents", sb);
                for (int i = 0; i < EstateBans.Length; ++i)
                {
                    EstateBan ban = EstateBans[i];
                    UUID      id  = ban.BannedUserID;
                    if (id == UUID.Zero)
                    {
                        continue;
                    }
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("id", id, sb);
                    LLSDxmlEncode.AddElem("banning_id", ban.BanningUserID, sb);
                    LLSDxmlEncode.AddElem("last_login_date", "na", sb);     // We will not have this. This information is far at grid
                    if (ban.BanTime == 0)
                    {
                        LLSDxmlEncode.AddElem("ban_date", "0000-00-00 00:00", sb);
                    }
                    else
                    {
                        LLSDxmlEncode.AddElem("ban_date", (Util.ToDateTime(ban.BanTime)).ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture), sb);
                    }
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }
            else
            {
                LLSDxmlEncode.AddEmptyArray("BannedAgents", sb);
            }

            if (managers != null && managers.Length > 0)
            {
                LLSDxmlEncode.AddArray("Managers", sb);
                for (int i = 0; i < managers.Length; ++i)
                {
                    LLSDxmlEncode.AddMap(sb);
                    LLSDxmlEncode.AddElem("agent_id", managers[i], sb);
                    LLSDxmlEncode.AddEndMap(sb);
                }
                LLSDxmlEncode.AddEndArray(sb);
            }
            else
            {
                LLSDxmlEncode.AddEmptyArray("Managers", sb);
            }

            LLSDxmlEncode.AddEndMap(sb);
            responsedata["str_response_string"] = LLSDxmlEncode.End(sb);

            return(responsedata);
        }