示例#1
0
        public ActionResult B_RoleMin(int id)
        {
            B_Role dbBORoles = B_Role.GetEntityByID(id);

            if (dbBORoles == null)
            {
                return(View(ErrorPage.ViewName, new ErrorPage {
                    Message = "分配角色权限失败,角色不存在或已删除!"
                }));
            }

            List <B_UserDesktopAuth> roRightsList = B_UserDesktopAuth.GetEntitysMainRoleID(id, CurrentUser.UserName);
            HashSet <int>            setRights    = new HashSet <int>();

            foreach (B_UserDesktopAuth roRights in roRightsList)
            {
                setRights.Add(roRights.MainID);
            }

            ViewBag.MenuRights = B_UserDesktopAuth.GetRolesDesktopAuth(id);

            ViewBag.HashRights     = setRights;
            ViewBag.dbBORoles      = dbBORoles;
            ViewData["UserName"]   = CurrentUser.UserName;
            ViewData["C_UserName"] = WeConfig.robot;
            return(View());
        }
示例#2
0
        public ActionResult B_RoleRight(int id)
        {
            B_Role dbBORoles = B_Role.GetEntityByID(id);

            if (dbBORoles == null)
            {
                return(View(ErrorPage.ViewName, new ErrorPage {
                    Message = "分配角色权限失败,角色不存在或已删除!"
                }));
            }

            List <B_Menu> Menus = B_Menu.GetValidMenus(true);

            if (CurrentUser.UserName != WeConfig.robot)
            {
                Menus.RemoveAll(m => m.IsRobot);

                foreach (var item in Menus)
                {
                    if (item.SubMenuList != null)
                    {
                        item.SubMenuList.RemoveAll(m => m.IsRobot);
                    }
                }
            }
            ViewBag.Menus      = Menus;
            ViewBag.MenuRights = B_MenuRights.GetEntitysDictionary();

            List <B_RoleRights> roRightsList = B_RoleRights.GetEntitysByRoleID(id);
            HashSet <int>       setRights    = new HashSet <int>();

            foreach (B_RoleRights roRights in roRightsList)
            {
                setRights.Add(roRights.RightID);
            }
            ViewBag.HashRights = setRights;
            ViewBag.dbBORoles  = dbBORoles;
            return(View());
        }
示例#3
0
        public ActionResult B_RoleEdit(int id)
        {
            B_Role role = B_Role.GetEntityByID(id);

            return(View(role));
        }