public ActionResult Index(int roleId = -1)
        {
            ViewBag.CurrentRoleId = roleId;

            SysRoleLogic   roleLogic = new SysRoleLogic();
            List <SysRole> roleList  = roleLogic.GetRoleList().ToList <SysRole>();

            ViewBag.RoleId = new SelectList(roleList, "RoleId", "RoleName");

            List <SysRoleRight> roleRightList = new List <SysRoleRight>();

            if (roleId > 0)
            {
                SysModuleLogic   moduleLogic = new SysModuleLogic();
                List <SysModule> moduleList  = moduleLogic.GetModuleList().ToList <SysModule>();
                ViewBag.ModuleList = moduleList;

                SysMenuLogic   menuLogic = new SysMenuLogic();
                List <SysMenu> menuList  = menuLogic.GetMenuList(0).ToList <SysMenu>();
                ViewBag.MenuList = menuList;

                roleRightList = logic.GetRoleRightList(roleId, false).ToList <SysRoleRight>();
            }

            return(View(roleRightList));
        }
示例#2
0
        void SetViewBagData()
        {
            SysRoleLogic   roleLogic  = new SysRoleLogic();
            List <SysRole> roleList   = roleLogic.GetRoleList().ToList <SysRole>();
            var            modelState = EnumHelper.GetItemValueList <EntityStatus>();

            this.ViewBag.ModelState = new SelectList(modelState, "Key", "Value");
        }
示例#3
0
        public ActionResult AccountInfo()
        {
            SysUser user = logic.GetUserInfo(this.WorkContext.CurrentUser.UserId);

            if (user != null)
            {
                Dictionary <int, SysRole> dictionaryRole = new Dictionary <int, SysRole>();
                SysRoleLogic   roleLogic = new SysRoleLogic();
                List <SysRole> roleList  = roleLogic.GetRoleList().ToList <SysRole>();
                if (roleList != null)
                {
                    for (int index = 0; index < roleList.Count; index++)
                    {
                        dictionaryRole.Add(roleList[index].RoleId, roleList[index]);
                    }
                }
                ViewBag.DictionaryRole = dictionaryRole;

                return(View(user));
            }
            return(RedirectToAction("Login", "Account"));
        }
示例#4
0
 public RoleAuthorizeController()
 {
     roleAuthorizeLogic = new SysRoleAuthorizeLogic();
     permissionLogic    = new SysPermissionLogic();
     _sysRoleLogic      = new SysRoleLogic();
 }
示例#5
0
 public RoleController()
 {
     roleLogic = new SysRoleLogic();
 }
        public ActionResult ConfigServiceRight(int roleId = -1, int userId = 0)
        {
            //具有国内/国际开发主管角色的登入用户进入该页后,角色下拉列表只列出国内/国际开发主管,
            //否则,列出国内开发主管和国际开发主管两角色:
            SysRoleLogic   roleLogic    = new SysRoleLogic();
            List <SysRole> roleList     = roleLogic.GetRoleList().ToList <SysRole>();
            LoginUserInfo  currentLogin = this.WorkContext.CurrentUser;

            //7表示国内开发主管角色,8表示国际开发主管角色
            if (currentLogin.RoleId == 7 || currentLogin.RoleId == 8)
            {
                roleList = roleList.Where(x => x.RoleId == currentLogin.RoleId).ToList <SysRole>();
            }
            else
            {
                roleList = roleList.Where(x => (x.RoleId == 7 || x.RoleId == 8)).ToList <SysRole>();
            }
            ViewBag.RoleId = new SelectList(roleList, "RoleId", "RoleName");
            if (roleId < 1)
            {
                if (currentLogin.RoleId == 7 || currentLogin.RoleId == 8)
                {
                    ViewBag.CurrentRoleId = currentLogin.RoleId;
                }
                else
                {
                    ViewBag.CurrentRoleId = 7;
                }
            }
            else
            {
                ViewBag.CurrentRoleId = roleId;
            }

            List <SysUser> userList = GetUserList(roleId);

            ViewBag.UserId        = new SelectList(userList, "UserId", "RealName");
            ViewBag.CurrentUserId = userId;

            List <SysRoleRight> roleRightList = new List <SysRoleRight>();

            if (roleId > 0)
            {
                SysApplicationLogic appIdMenuLogic = new SysApplicationLogic();

                //求配置中心权限管理模块的各菜单项:
                List <SysApplicationEntity> appIdMenuList = null;
                SysUserLogic sysUserLogic     = new SysUserLogic();
                SysUser      sysUser          = null;
                int?         selectedUserId   = -1;
                string       selectedUserName = string.Empty;
                switch (roleId)
                {
                case 7:    //国内开发主管角色,目前只求针对国内机票产品线的配置中心权限管理模块的各菜单项:
                    sysUser = sysUserLogic.GetUserInfo(userId);
                    if (sysUser != null)
                    {
                        selectedUserName        = sysUser.RealName;
                        ViewBag.CurrentUserName = selectedUserName;
                    }
                    appIdMenuList = appIdMenuLogic.GetSysApplicationList(-1, -1, "", -1, -1, null, new List <int> {
                        1
                    }, selectedUserName).ToList <SysApplicationEntity>();
                    break;

                case 8:     //国际开发主管角色,目前只求针对国际机票产品线的配置中心权限管理模块的各菜单项:
                    sysUser = sysUserLogic.GetUserInfo(userId);
                    if (sysUser != null)
                    {
                        selectedUserName        = sysUser.RealName;
                        ViewBag.CurrentUserName = selectedUserName;
                    }
                    appIdMenuList = appIdMenuLogic.GetSysApplicationList(-1, -1, "", -1, -1, null, new List <int> {
                        2
                    }, selectedUserName).ToList <SysApplicationEntity>();
                    break;

                default:
                    break;
                }
                ViewBag.AppIdMenuList = appIdMenuList;

                selectedUserId = ViewBag.CurrentUserId as int?;
                roleRightList  = logic.GetRoleRightList(roleId, true, (selectedUserId.HasValue ? Convert.ToInt32(selectedUserId) : -1)).ToList <SysRoleRight>();
            }

            return(View(roleRightList));
        }