public SysActionMenuService(ISysActionMenuDao dao, ISysActionService sysActionService)
 {
     this.dao         = dao;
     base.CurrentDao  = dao;
     SysActionService = sysActionService;
     this.AddDisposableObject(this.CurrentDao);
     this.AddDisposableObject(this.SysActionService);
 }
Exemplo n.º 2
0
 public SysActionController(ISysActionService sysActionService, ISysActionButtonService sysActionButtonService, ISysActionMenuService sysActionMenuService)
 {
     base.SysActionService       = sysActionService;
     base.SysActionButtonService = sysActionButtonService;
     base.SysActionMenuService   = sysActionMenuService;
     this.AddDisposableObject(SysActionService);
     this.AddDisposableObject(SysActionButtonService);
     this.AddDisposableObject(SysActionMenuService);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="sysActionService"></param>
 /// <param name="sysAreaService"></param>
 /// <param name="unitOfWork"></param>
 /// <param name="sysControllerService"></param>
 /// <param name="sysControllerSysActionService"></param>
 public SysControllerController(ISysActionService sysActionService, ISysAreaService sysAreaService,
                                IUnitOfWork unitOfWork, ISysControllerService sysControllerService,
                                ISysControllerSysActionService sysControllerSysActionService)
 {
     _sysActionService              = sysActionService;
     _sysAreaService                = sysAreaService;
     _unitOfWork                    = unitOfWork;
     _sysControllerService          = sysControllerService;
     _sysControllerSysActionService = sysControllerSysActionService;
 }
 public SysControllerController(ISysActionService sysActionService, ISysAreaService sysAreaService,
                                IUnitOfWork unitOfWork, ISysControllerService sysControllerService,
                                ISysControllerSysActionService sysControllerSysActionService)
 {
     _sysActionService = sysActionService;
     _sysAreaService = sysAreaService;
     _unitOfWork = unitOfWork;
     _sysControllerService = sysControllerService;
     _sysControllerSysActionService = sysControllerSysActionService;
 }
Exemplo n.º 5
0
 public AuthorityController(ISysActionService sysActionService,
                            ISysAdminService sysAdminService,
                            ISysRoleService sysRoleService,
                            ISysRoleActionService sysRoleActionService,
                            ISysAdminRoleService sysAdminRoleService,
                            ISysMenuService sysMenuService)
 {
     _sysActionService     = sysActionService;
     _sysAdminService      = sysAdminService;
     _sysRoleService       = sysRoleService;
     _sysRoleActionService = sysRoleActionService;
     _sysAdminRoleService  = sysAdminRoleService;
     _sysMenuService       = sysMenuService;
 }
        public void OnAuthorization(AuthorizationContext filterContext)
        {
            //判断是否有贴跳过登录检查的特性标签(控制器)
            if (filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(SkipCheckLogin), false))
            {
                return;
            }

            //方法
            if (filterContext.ActionDescriptor.IsDefined(typeof(SkipCheckLogin), false))
            {
                return;
            }

            if (!string.IsNullOrEmpty(CookieHelper.Get(KeyManager.IsMember)))
            {
                List <string> list = DESUtils.Decrypt(CookieHelper.Get(KeyManager.IsMember)).ToList <string>();
                if (list == null || list.Count() != 2)
                {
                    ToLogin(filterContext);
                    return;
                }
                SysUser userinfo = CacheManager.Get <SysUser>(list[0]);
                if (userinfo != null)
                {
                    // 0为永久key
                    if (list[1] == "0")
                    {
                        CacheManager.Set(list[0], userinfo, new TimeSpan(10, 0, 0, 0));
                    }
                    // 1为滑动key
                    else if (list[1] == "1")
                    {
                        CacheManager.Set(list[0], userinfo, new TimeSpan(0, 30, 0));
                        CookieHelper.Set(KeyManager.IsMember, DESUtils.Encrypt(list.ToJson()), 30);
                    }
                    else
                    {
                        ToLogin(filterContext);
                        return;
                    }
                }
                else
                {
                    ToLogin(filterContext);
                    return;
                }
            }
            else
            {
                ToLogin(filterContext);
                return;
            }

            //获得当前要执行的Action上标注的CheckPermissionAttribute实例对象
            CheckPermission[] permAtts = (CheckPermission[])filterContext.ActionDescriptor
                                         .GetCustomAttributes(typeof(CheckPermission), false);
            if (permAtts.Length <= 0)
            {
                return;
            }

            var container = CacheManager.Get <IContainer>(KeyManager.AutofacContainer);
            ISysActionService sysActionService = container.Resolve <ISysActionService>();

            //检查是否有权限
            foreach (var permAtt in permAtts)
            {
                //判断当前登录用户是否具有permAtt.Permission权限
                if (!sysActionService.HasPermission(UserManager.GetCurrentUserInfo().Id, permAtt.Permission))
                {
                    NoPermission(filterContext);
                    return;
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sysActionService"></param>
 /// <param name="unitOfWork"></param>
 public SysActionController(ISysActionService sysActionService, IUnitOfWork unitOfWork)
 {
     _sysActionService = sysActionService;
     _unitOfWork       = unitOfWork;
 }
Exemplo n.º 8
0
 public SysActionController(ISysActionService sysActionService, IUnitOfWork unitOfWork)
 {
     _sysActionService = sysActionService;
     _unitOfWork = unitOfWork;
 }