zoukankan      html  css  js  c++  java
  • 权限获取异常(不能用ModuleId,得换个名字)目前还没搞清楚为啥

    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;
            }
  • 相关阅读:
    C#网络编程.套接字.TcpListener.TcpClient
    GUI原型设计工具
    C#网络编程.2.套接字.TcpListener.TcpClient.服务端客户端通信
    网站开发策略选择
    jsdefinitionguide0221
    jquery0224
    sql trigger
    实现类似51job的选择框
    完美曲线
    MonoDroid
  • 原文地址:https://www.cnblogs.com/yechangzhong-826217795/p/5674770.html
Copyright © 2011-2022 走看看