Beispiel #1
0
        public LoginUserVM GetLoginUser(string username)
        {
            _service.GetUserAccessed(username);
            var user = new LoginUserVM
            {
                User         = _service.User,
                AccessedOrgs = _service.Orgs,
                Modules      = _service.Modules.MapToList <ModuleView>(),
                Resources    = _service.Resources,
            };

            foreach (var moduleView in user.Modules)
            {
                moduleView.Elements =
                    _service.ModuleElements.Where(u => u.ModuleId == moduleView.Id).OrderBy(u => u.Sort).ToList();
            }

            return(user);
        }
Beispiel #2
0
        public LoginUserVM GetLoginUser()
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                throw new HttpException(401, "未登录");
            }
            string username = HttpContext.Current.User.Identity.Name;

            _service.GetUserAccessed(username);
            var user = new LoginUserVM
            {
                User         = _service.User,
                AccessedOrgs = _service.Orgs,
                Modules      = _service.Modules.MapToList <ModuleView>(),
                Resources    = _service.Resources,
            };

            foreach (var moduleView in user.Modules)
            {
                moduleView.Elements = _service.ModuleElements.Where(u => u.ModuleId == moduleView.Id).OrderBy(u => u.Sort).ToList();
            }

            return(user);
        }