コード例 #1
0
        public async Task<IActionResult> Index(
            Guid? siteGuid,
            string query = "",
            int sortMode = 2,
            int pageNumber = 1,
            int pageSize = -1
            )
        {
            ISiteSettings selectedSite;
            // only server admin site can edit other sites settings
            if ((siteGuid.HasValue) && (siteGuid.Value != Guid.Empty) && (siteGuid.Value != siteManager.CurrentSite.SiteGuid) && (siteManager.CurrentSite.IsServerAdminSite))
            {
                selectedSite = await siteManager.Fetch(siteGuid.Value);
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, "{0} - User Management", selectedSite.SiteName);
            }
            else
            {
                selectedSite = siteManager.CurrentSite;
                ViewData["Title"] = localizer["User Management"];
            }

            
            
           // ViewData["Heading"] = ViewData["Title"];

            int itemsPerPage = uiOptions.DefaultPageSize_UserList;
            if (pageSize > 0)
            {
                itemsPerPage = pageSize;
            }

            

            var siteMembers = await UserManager.GetPage(
                selectedSite.SiteId,
                pageNumber,
                itemsPerPage,
                query,
                sortMode);

            var count = await UserManager.CountUsers(selectedSite.SiteId, query);

            UserListViewModel model = new UserListViewModel();
            model.SiteGuid = selectedSite.SiteGuid;
           // model.Heading = "User Management";
            model.UserList = siteMembers;
            model.Paging.CurrentPage = pageNumber;
            model.Paging.ItemsPerPage = itemsPerPage;
            model.Paging.TotalItems = count;
            model.AlphaQuery = query; //TODO: sanitize

            return View(model);


        }
コード例 #2
0
        public async Task<IActionResult> IpSearch(
            Guid? siteGuid,
            string ipQuery = "")
        {
            ISiteSettings selectedSite;
            // only server admin site can edit other sites settings
            if ((siteGuid.HasValue) && (siteGuid.Value != Guid.Empty) && (siteGuid.Value != siteManager.CurrentSite.SiteGuid) && (siteManager.CurrentSite.IsServerAdminSite))
            {
                selectedSite = await siteManager.Fetch(siteGuid.Value);
            }
            else
            {
                selectedSite = siteManager.CurrentSite;
            }

            ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, "{0} - User Management", selectedSite.SiteName);
            
            List<IUserInfo> siteMembers = await UserManager.GetByIPAddress(
                selectedSite.SiteGuid,
                ipQuery);


            UserListViewModel model = new UserListViewModel();
            model.SiteGuid = selectedSite.SiteGuid;
            //model.Heading = "User Management";
            model.UserList = siteMembers;
            //model.Paging.CurrentPage = pageNumber;
            //model.Paging.ItemsPerPage = itemsPerPage;
            model.Paging.TotalItems = 1;
            model.IpQuery = ipQuery; //TODO: sanitize
            model.ShowAlphaPager = false;

            return View("Index", model);


        }
コード例 #3
0
        public async Task<IActionResult> UnApprovedUsers(
            Guid? siteGuid,
            int pageNumber = 1,
            int pageSize = -1)
        {
            ISiteSettings selectedSite;
            // only server admin site can edit other sites settings
            if ((siteGuid.HasValue) && (siteGuid.Value != Guid.Empty) && (siteGuid.Value != siteManager.CurrentSite.SiteGuid) && (siteManager.CurrentSite.IsServerAdminSite))
            {
                selectedSite = await siteManager.Fetch(siteGuid.Value);
            }
            else
            {
                selectedSite = siteManager.CurrentSite;
            }

            ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, "{0} - User Accounts Pending Approval", selectedSite.SiteName);

            int itemsPerPage = uiOptions.DefaultPageSize_UserList;
            if (pageSize > 0)
            {
                itemsPerPage = pageSize;
            }


            var siteMembers = await UserManager.GetNotApprovedUsers(
                selectedSite.SiteId,
                pageNumber,
                itemsPerPage);

            var count = await UserManager.CountNotApprovedUsers(selectedSite.SiteId);

            UserListViewModel model = new UserListViewModel();
            model.SiteGuid = selectedSite.SiteGuid;
            model.UserList = siteMembers;
            model.Paging.CurrentPage = pageNumber;
            model.Paging.ItemsPerPage = itemsPerPage;
            model.Paging.TotalItems = count;

            model.ShowAlphaPager = false;

            return View(model);

        }
コード例 #4
0
        public async Task<IActionResult> Index(
            Guid? siteId,
            string query = "",
            int sortMode = 0,  //sortMode: 0 = DisplayName asc, 1 = JoinDate desc, 2 = Last, First
            int pageNumber = 1,
            int pageSize = -1
            )
        {
            var selectedSite = await siteManager.GetSiteForDataOperations(siteId);
            // only server admin site can edit other sites settings
            if (selectedSite.Id != siteManager.CurrentSite.Id)
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - User Management"], selectedSite.SiteName);
            }
            else
            {
                ViewData["Title"] = sr["User Management"];
            }
            
            var itemsPerPage = uiOptions.DefaultPageSize_UserList;
            if (pageSize > 0)
            {
                itemsPerPage = pageSize;
            }
            
            var siteMembers = await UserManager.GetPage(
                selectedSite.Id,
                pageNumber,
                itemsPerPage,
                query,
                sortMode);

            var count = await UserManager.CountUsers(selectedSite.Id, query);

            var model = new UserListViewModel();
            model.SiteId = selectedSite.Id;
            model.UserList = siteMembers;
            model.Paging.CurrentPage = pageNumber;
            model.Paging.ItemsPerPage = itemsPerPage;
            model.Paging.TotalItems = count;
            model.SortMode = sortMode;
            model.AlphaQuery = query; //TODO: sanitize?
            model.TimeZoneId = await timeZoneIdResolver.GetUserTimeZoneId();

            return View(model);

        }
コード例 #5
0
        public async Task<IActionResult> UnApprovedUsers(
            Guid? siteId,
            int pageNumber = 1,
            int pageSize = -1)
        {
            var selectedSite = await siteManager.GetSiteForDataOperations(siteId);
            // only server admin site can edit other sites settings
            if (selectedSite.Id != siteManager.CurrentSite.Id)
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - User Accounts Pending Approval"], selectedSite.SiteName);
            }
            else
            {
                ViewData["Title"] = sr["User Accounts Pending Approval"];
            }

            var itemsPerPage = uiOptions.DefaultPageSize_UserList;
            if (pageSize > 0)
            {
                itemsPerPage = pageSize;
            }
            
            var siteMembers = await UserManager.GetNotApprovedUsers(
                selectedSite.Id,
                pageNumber,
                itemsPerPage);

            var count = await UserManager.CountNotApprovedUsers(selectedSite.Id);

            var model = new UserListViewModel();
            model.SiteId = selectedSite.Id;
            model.UserList = siteMembers;
            model.Paging.CurrentPage = pageNumber;
            model.Paging.ItemsPerPage = itemsPerPage;
            model.Paging.TotalItems = count;
            model.ShowAlphaPager = false;
            model.TimeZoneId = await timeZoneIdResolver.GetUserTimeZoneId();
            model.ActionName = "UnApprovedUsers";
            return View(model);
        }
コード例 #6
0
        public async Task<IActionResult> IpSearch(
            Guid? siteId,
            string ipQuery = "")
        {
            var selectedSite = await siteManager.GetSiteForDataOperations(siteId);
            // only server admin site can edit other sites settings
            if (selectedSite.Id != siteManager.CurrentSite.Id)
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - User Management"], selectedSite.SiteName);
            }
            else
            {
                ViewData["Title"] = sr["User Management"];
            }
            
            var siteMembers = await UserManager.GetByIPAddress(
                selectedSite.Id,
                ipQuery);
            
            var model = new UserListViewModel();
            model.SiteId = selectedSite.Id;
            model.UserList = siteMembers;
            //model.Paging.CurrentPage = pageNumber;
            //model.Paging.ItemsPerPage = itemsPerPage;
            model.Paging.TotalItems = 1;
            model.IpQuery = ipQuery; //TODO: sanitize
            model.ShowAlphaPager = false;
            model.TimeZoneId = await timeZoneIdResolver.GetUserTimeZoneId();
            model.ActionName = "IpSearch";
            return View("Index", model);

        }