示例#1
0
 public RoleController(
     IsysRoleServices roleSer,
     IsysOrganStructServices oSer,
     IsysMenusServices mSer,
     IsysFunctionServices fSer,
     IsysPermissListServices pSer)
 {
     base._organSer   = oSer;
     base._roleSer    = roleSer;
     base._menuSer    = mSer;
     base._funSer     = fSer;
     base._permissSer = pSer;
 }
示例#2
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //0.0判断是否有贴跳过权限检查的特性标签
            if (filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(SkipCheckPermiss), false))
            {
                return;
            }

            if (filterContext.ActionDescriptor.IsDefined(typeof(SkipCheckPermiss), false))
            {
                return;
            }

            //1.0 获取当前触发此OnActionExecuting的aciton
            string actionName = filterContext.ActionDescriptor.ActionName.ToLower();

            //2.0 控制名称
            string controlerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToLower();

            //3.0 获取区域的名称
            string areaName = string.Empty;

            if (filterContext.RouteData.DataTokens.ContainsKey("area"))
            {
                areaName = filterContext.RouteData.DataTokens["area"].ToString().ToLower();
            }

            //4.0 根据上面的三个成员的值作为条件去当前用户的权限按钮缓存数据查找,如果没有找到则表示没有权限
            //2.0.1 从缓存中获取autofac的容器对象
            var cont = CacheMgr.GetData <IContainer>(Keys.AutofacContainer);
            IsysPermissListServices iperSer = cont.Resolve <IsysPermissListServices>();
            var list = iperSer.GetFunctionsForUserByCache(UserMgr.GetCurrentUserInfo().uID);

            var isOK = list.Any(c => c.mArea.ToLower() == areaName &&
                                c.mController.ToLower() == controlerName &&
                                c.fFunction.ToLower() == actionName);

            if (isOK == false)
            {
                isOK = list.Any(c => c.mArea.ToLower() == areaName &&
                                c.mController.ToLower() == controlerName &&
                                c.mAction.ToLower() == actionName);
            }

            if (isOK == false)//无权限
            {
                ToLogin(filterContext);
            }
        }
示例#3
0
 public LoginController(IsysUserInfoServices userSer, IsysPermissListServices pSer)
 {
     base._userinfoSer = userSer;
     base._permissSer  = pSer;
 }
示例#4
0
 public roleController(IsysOrganStructServices oSer, IsysRoleServices rSer, IsysMenusServices mSer, IsysFunctionServices fSer, IsysPermissListServices pser)
 {
     base.organSer   = oSer;
     base.roleSer    = rSer;
     base.menuSer    = mSer;
     base.funSer     = fSer;
     base.permissSer = pser;
 }
示例#5
0
 public PermissOptController(IsysPermissListServices pSer)
 {
     base.permissSer = pSer;
 }
示例#6
0
 public LoginController(IsysUserInfoServices userSer, IsysFunctionServices funSer, IsysPermissListServices pSer)
 {
     base.userinfoSer = userSer;
     base.funSer      = funSer;
     base.permissSer  = pSer;
 }