/// <summary>
        /// 加入功能的其他Path
        /// </summary>
        /// <param name="menuFuncVO">要加入Path的功能</param>
        /// <param name="path">要加入Path</param>
        public void AddOtherPath(MenuFuncVO menuFuncVO, string path)
        {
            FunctionPathVO functionPathVO = new FunctionPathVO();
            functionPathVO.Path = path;
            functionPathVO.MenuFunc = menuFuncVO;

            MenuFuncDao.CreateFunctionPath(functionPathVO);
        }
        /// <summary>
        /// 新增後台功能
        /// </summary>
        /// <param name="menuFuncVO">被新增的後台功能</param>
        /// <returns>新增後的後台功能</returns>
        public MenuFuncVO CreateMenuFunc(MenuFuncVO menuFuncVO)
        {
            NHibernateDao.Insert(menuFuncVO);

            return menuFuncVO;
        }
Esempio n. 3
0
 public MenuFuncVO(string menuFuncName, MenuFuncVO parentMenu, string note)
 {
     this.MenuFuncName = menuFuncName;
     this.ParentMenu   = parentMenu;
     this.Note         = note;
 }
Esempio n. 4
0
 public MenuFuncVO(string menuFuncName, MenuFuncVO parentMenu)
 {
     this.MenuFuncName = menuFuncName;
     this.ParentMenu   = parentMenu;
 }
 /// <summary>
 /// 新增後台功能
 /// </summary>
 /// <param name="menuFuncVO">被新增的後台功能</param>
 /// <returns>新增後的後台功能</returns>
 public MenuFuncVO CreateMenuFunc(MenuFuncVO menuFuncVO)
 {
     return MenuFuncDao.CreateMenuFunc(menuFuncVO);
 }
        /// <summary>
        /// 檢查使用者是否有此單一清單的權限
        /// </summary>
        /// <param name="user"></param>
        /// <param name="subFunc"></param>
        /// <returns></returns>
        private bool UserHasMenuRight(LoginUserVO user, MenuFuncVO subFunc, Dictionary<int, LoginRoleVO> roleDic)
        {
            if (user.LoginRoleList != null && user.LoginRoleList.Count > 0)
            {
                foreach (LoginRoleVO role in user.LoginRoleList)
                {
                    LoginRoleVO cacheRole = roleDic[role.RoleId];

                    if (RoleHasMenuRight(cacheRole, subFunc))
                    {
                        return true;
                    }
                }
            }

            return false;
        }
        /// <summary>
        /// 群組是否有此功能清單的權限
        /// </summary>
        /// <param name="role"></param>
        /// <param name="subFunc"></param>
        /// <returns></returns>
        private bool RoleHasMenuRight(LoginRoleVO role, MenuFuncVO subFunc)
        {
            foreach (MenuFuncVO roleHasFunc in role.MenuFuncList)
            {
                if (roleHasFunc.MenuFuncId.Equals(subFunc.MenuFuncId))
                {
                    return true;
                }
            }

            return false;
        }
        /// <summary>
        /// 取得屬於這個User的權限的功能清單
        /// </summary>
        /// <returns>屬於這個User的權限的功能清單</returns>
        public IList<MenuFuncVO> GetTopMenuFunc(LoginUserVO user, IList<MenuFuncVO> allMenu, Dictionary<int, LoginRoleVO> roleDic)
        {
            IList<MenuFuncVO> authMenuList = new List<MenuFuncVO>();

            foreach (MenuFuncVO menu in allMenu)
            {
                if (menu.SubFuncs.Count > 0)
                {
                    int i = 1;  //判斷是否第一次執行
                    MenuFuncVO parentMenu = new MenuFuncVO();

                    foreach (MenuFuncVO subFunc in menu.SubFuncs)
                    {
                        if (UserHasMenuRight(user, subFunc, roleDic))
                        {
                            if (i == 1)
                            {
                                parentMenu = menu;
                                authMenuList.Add(parentMenu);
                                parentMenu.SubFuncs = new List<MenuFuncVO>();
                            }
                            parentMenu.SubFuncs.Add(subFunc);
                            i++;
                        }
                    }
                }
            }
            return authMenuList;
        }
        /// <summary>
        /// 判斷後台角色是否有此功能的權限
        /// </summary>
        /// <param name="loginRoleVO">後台角色</param>
        /// <param name="subMenuFuncVO">後台功能</param>
        /// <returns>群組是否有此功能清單的權限</returns>
        bool IAuthService.RoleHasMenuRight(LoginRoleVO loginRoleVO, MenuFuncVO subMenuFuncVO)
        {
            foreach (MenuFuncVO roleHasFunc in loginRoleVO.MenuFuncList)
            {
                if (roleHasFunc.MenuFuncId.Equals(subMenuFuncVO.MenuFuncId))
                {
                    return true;
                }
            }

            return false;
        }
Esempio n. 10
0
 public MenuFuncVO(string menuFuncName, MenuFuncVO parentMenu,string note)
 {
     this.MenuFuncName = menuFuncName;
     this.ParentMenu = parentMenu;
     this.Note = note;
 }
Esempio n. 11
0
 public MenuFuncVO(string menuFuncName, MenuFuncVO parentMenu)
 {
     this.MenuFuncName = menuFuncName;
     this.ParentMenu = parentMenu;
 }
        private MenuFuncVO CreateSubMenu(string menuName, MenuFuncVO parentMenu, int sort, string path)
        {
            MenuFuncVO menuFuncVO = new MenuFuncVO(menuName, parentMenu);
            menuFuncVO.ListOrder = sort;
            menuFuncVO.MainPath = path;

            return m_AuthService.CreateMenuFunc(menuFuncVO);
        }
        private MenuFuncVO CreateParentMenu(string menuName, int sort)
        {
            MenuFuncVO menuFuncVO = new MenuFuncVO(menuName, null);
            menuFuncVO.ListOrder = sort;

            return m_AuthService.CreateMenuFunc(menuFuncVO);
        }
Esempio n. 14
0
    private void FillLog(MenuFuncVO m)
    {
        AuthFactory authFactory = new AuthFactory();
        IAuthService authService = authFactory.GetAuthService();

        MenuFuncVO parentMenu = authService.GetMenuFuncById(m.ParentMenu.MenuFuncId);
        string functionName = parentMenu.MenuFuncName;
        string subfunctionName = m.MenuFuncName;
        m_Log.Debug("functionName:" + functionName + " >> " + m.MenuFuncName);
        SessionHelper sessionHelper = new SessionHelper();
        LogSystemVO logSystemVO = new LogSystemVO();
        logSystemVO.Fucntion = functionName;
        logSystemVO.SubFucntion = subfunctionName;
        sessionHelper.LogVO = logSystemVO;
    }