예제 #1
0
        public string RegionManagementGetRequest(Environment env)
        {
            m_log.DebugFormat("[Services]: RegionManagementGetRequest()");
            Request request = env.TheRequest;

            SessionInfo sinfo;

            if (TryGetSessionInfo(request, out sinfo) &&
                (sinfo.Account.UserLevel >= m_WebApp.AdminUserLevel))
            {
                List <GridRegion> regions = m_GridService.GetRegionsByName(UUID.Zero, "", 200);

                m_log.DebugFormat("[Services]: There are {0} regions", regions.Count);
                regions.ForEach(delegate(GridRegion gg)
                {
                    m_log.DebugFormat("[Services] {0}", gg.RegionName);
                });

                env.Session = sinfo;
                env.Data    = WebAppUtils.Objectify(regions);
                env.Flags   = Flags.IsAdmin | Flags.IsLoggedIn;
                env.State   = State.RegionManagementForm;
                return(WebAppUtils.PadURLs(env, sinfo.Sid, m_WebApp.ReadFile(env, "index.html")));
            }
            else
            {
                return(m_WebApp.ReadFile(env, "index.html"));
            }
        }
예제 #2
0
        public string UserSearchPostRequest(Environment env, string terms)
        {
            m_log.DebugFormat("[Wifi]: UserSearchPostRequest");
            Request request = env.TheRequest;

            SessionInfo sinfo;

            if (TryGetSessionInfo(request, out sinfo) &&
                (sinfo.Account.UserLevel >= m_WebApp.AdminUserLevel))
            {
                if (terms != string.Empty)
                {
                    env.Session = sinfo;
                    env.Flags   = Flags.IsLoggedIn | Flags.IsAdmin;
                    env.State   = State.UserSearchFormResponse;
                    // Put the list in the environment
                    List <UserAccount> accounts = m_UserAccountService.GetActiveAccounts(UUID.Zero, terms, m_PendingIdentifier);
                    env.Data = WebAppUtils.Objectify <UserAccount>(accounts);

                    return(WebAppUtils.PadURLs(env, sinfo.Sid, m_WebApp.ReadFile(env, "index.html")));
                }
                else
                {
                    return(UserManagementGetRequest(env));
                }
            }

            return(m_WebApp.ReadFile(env, "index.html"));
        }
예제 #3
0
        private List <object> GetHyperlinks(Environment env, UUID owner)
        {
            List <GridRegion> hyperlinks = m_GridService.GetHyperlinks(UUID.Zero);
            List <RegionInfo> links      = new List <RegionInfo>();

            if (hyperlinks != null)
            {
                foreach (GridRegion region in hyperlinks)
                {
                    RegionInfo link = new RegionInfo(region);
                    if (m_WebApp.HyperlinksShowAll ||
                        (env.Flags & Flags.IsAdmin) != 0 ||
                        (link.RegionOwnerID == owner) ||
                        (link.RegionOwnerID == UUID.Zero))
                    {
                        if (link.RegionOwnerID != UUID.Zero)
                        {
                            UserAccount user = m_UserAccountService.GetUserAccount(UUID.Zero, link.RegionOwnerID);
                            if (user != null)
                            {
                                link.RegionOwner = user.Name;
                            }
                        }
                        links.Add(link);
                    }
                }
            }
            return(WebAppUtils.Objectify <RegionInfo>(links));
        }
예제 #4
0
 private List <object> GetGroupsList(Environment env)
 {
     if (m_GroupsService != null)
     {
         List <DirGroupsReplyData> groups = m_GroupsService.FindGroups(string.Empty, string.Empty);
         if (groups != null && groups.Count > 0)
         {
             return(WebAppUtils.Objectify <DirGroupsReplyData>(groups));
         }
     }
     return(new List <object>());
 }
예제 #5
0
        /*
         * private void PrintStr(string html)
         * {
         *  foreach (char c in html)
         *      Console.Write(c);
         * }
         */
        private List <object> GetUserList(Environment env, string terms)
        {
            List <UserAccount> accounts = m_UserAccountService.GetUserAccounts(UUID.Zero, terms);

            if (accounts != null && accounts.Count > 0)
            {
                return(WebAppUtils.Objectify <UserAccount>(accounts));
            }
            else
            {
                return(new List <object>());
            }
        }
예제 #6
0
        private List <object> GetDefaultAvatarSelectionList()
        {
            // Present only default avatars of a non-empty type.
            // This allows to specify a default avatar which is used when none is selected
            // during account creation. Use the following configuration settings to enable
            // this ("Default Avatar" may be any avatar name or "" to create an empty
            // standard inventory):
            // [WifiService]
            //    AvatarAccount_ = "Default Avatar"
            //    AvatarPreselection = ""
            IEnumerable <Avatar> visibleAvatars = m_WebApp.DefaultAvatars.Where(avatar => !string.IsNullOrEmpty(avatar.Type));

            return(WebAppUtils.Objectify <Avatar>(visibleAvatars));
        }
예제 #7
0
        private List <object> GetRegionList(Environment env)
        {
            List <GridRegion> regions = m_GridService.GetRegionsByName(UUID.Zero, "", 100);

            if (regions != null)
            {
                m_log.DebugFormat("[Wifi]: GetRegionList found {0} users in DB", regions.Count);
                return(WebAppUtils.Objectify <GridRegion>(regions));
            }
            else
            {
                m_log.DebugFormat("[Wifi]: GetRegionList got null regions from DB");
                return(new List <object>());
            }
        }