コード例 #1
0
        public ActionResult UserUpdate(string userName)
        {
            IRole role = irep.GetUsersRole(userName);

            if (role.Role_Name == null)
            {
                ViewBag.Role = irep.GetUsersRole("normal");
            }
            else
            {
                ViewBag.Role = role;
            }
            ViewBag.AuthorityList = irep.GetRolesAuthority(role.Role_Name);
            return(View(irep.GetUser(userName)));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: PengLL/Authority
        public PartialViewResult Menu()
        {
            IAuthorities[]     list;
            IRole              role          = irep.GetUsersRole(userName);
            List <Authorities> urlListToShow = new List <Authorities>();

            if (role.SuperAdmin == true)
            {
                list = irep.GetAllAuthorities();
            }
            else
            {
                list = irep.GetRolesAuthority(role.Role_Name);
            }
            foreach (Authorities au in list)
            {
                if (au.Url.Contains("Home"))
                {
                    urlListToShow.Add(au);
                }
            }
            ViewBag.UrlListToShow = urlListToShow;
            ViewBag.UserName      = userName;
            return(PartialView());
        }