码迷,mamicode.com
首页 > 其他好文 > 详细

权限获取异常(不能用ModuleId,得换个名字)目前还没搞清楚为啥

时间:2016-07-16 00:30:13      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:

CenterController:

    /// <summary>
        /// 访问模块,写入系统菜单Id
        /// </summary>
        /// <param name="ModuleId"></param>
        /// <param name="ModuleName"></param>
        /// <returns></returns>
        public ActionResult SetModuleId(string ModuleId,string ModuleName)
        {
            string _ModuleId = DESEncrypt.Encrypt(ModuleId);
            CookieHelper.WriteCookie("ModuleId", _ModuleId);
            CookieHelper.WriteCookie("ThisModuleId", _ModuleId);
            var aa = CookieHelper.GetCookie("ModuleId");
            if (!string.IsNullOrEmpty(ModuleName))
            {

                Sys_SysLogBll.Instance.WriteLog(ModuleId, OperationType.Visit, "1", ModuleName);
            }
            return Content(_ModuleId);
        }

AuthorizationAttribute:

        /// <summary>
        /// 执行权限认证
        /// </summary>
        /// <returns></returns>
        private bool ActionAuthorize(AuthorizationContext filterContext)
        {
            if (ManageProvider.Provider.Current().IsSystem)
                return true;
            var areaName = filterContext.RouteData.DataTokens["area"] + "/";            //获取当前区域
            var controllerName = filterContext.RouteData.Values["controller"] + "/";    //获取控制器
            var action = filterContext.RouteData.Values["Action"];                      //获取当前Action
            string requestPath = "/" + areaName + controllerName + action;              //拼接构造完整url
            string ModuleId = DESEncrypt.Decrypt(CookieHelper.GetCookie("ThisModuleId"));
            bool Result = Sys_ModulePermissionBll.Instance.ActionAuthorize(requestPath.ToLower(), ManageProvider.Provider.Current().ObjectId, ModuleId, ManageProvider.Provider.Current().UserId);
            return Result;
        }

 

权限获取异常(不能用ModuleId,得换个名字)目前还没搞清楚为啥

标签:

原文地址:http://www.cnblogs.com/yechangzhong-826217795/p/5674770.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!