Beispiel #1
0
        /// <summary>
        /// 是否有权限
        /// </summary>
        /// <param name="authCode"></param>
        /// <returns></returns>
        public static bool HasAuth(string authCode)
        {
            bool       result     = false;
            SysUserDAL userHandle = new SysUserDAL();
            var        user       = userHandle.Detail(ConvertHelper.ToInt32(AuthenWidget.CurrentOperator?.UserId ?? 0));

            result = ConvertHelper.StrIn(user.PersonalAuth, authCode);

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 获取列表操作权限
        /// </summary>
        /// <param name="menuCode"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static Dictionary <string, bool> GetMyMenuAuth(string menuCode)
        {
            Dictionary <string, bool> list = new Dictionary <string, bool>();
            SysMenuDAL menuhandle          = new SysMenuDAL();
            SysUserDAL userHandle          = new SysUserDAL();
            var        user = userHandle.Detail(ConvertHelper.ToInt32(AuthenWidget.CurrentOperator?.UserId ?? 0));

            foreach (var item in menuhandle.GetMenuAuth(menuCode))
            {
                bool hasAuth = ConvertHelper.StrIn(user.PersonalAuth, item);
                list.Add(item.Split('_')[1], hasAuth);
            }

            return(list);
        }