Пример #1
0
        /// <summary>
        /// 获取模块权限值
        /// </summary>
        /// <param name="MenuName"></param>
        /// <returns></returns>
        public static int?GetModuleAuth(string MenuName)
        {
            View_UserAuthority view = Loginer.LoginerUser.UserAuthority.Where(t => t.MenuName.Equals(MenuName)).OrderByDescending(t => t.Authorities).First();

            if (view == null)
            {
                return(0);
            }
            else
            {
                return(view.Authorities);
            }
        }
Пример #2
0
        /// <summary>
        ///  权限验证
        /// </summary>
        /// <returns></returns>
        public bool ModuleVerify(ModuleAttribute bute)
        {
            bool result = false;

            if (Loginer.LoginerUser.IsAdmin)
            {
                result = true;
            }
            else
            {
                _UserAuthority = Loginer.LoginerUser.UserAuthority.FirstOrDefault(t => t.MenuName.Equals(bute.Name));
                if (_UserAuthority != null)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }