Esempio n. 1
0
 public UserController(IUserBusiness userBusiness,
                       IPermissionBusiness permissionBusiness
                       )
 {
     _userBusiness       = userBusiness;
     _permissionBusiness = permissionBusiness;
 }
 public AuthenticateBusiness(ICustomerBusiness customerBusiness, IEncryptorHandler encryptorHandler,
                             ITokenHandler tokenHandler, IPermissionBusiness permissionBusiness)
 {
     _customerBusiness   = customerBusiness;
     _permissionBusiness = permissionBusiness;
     _encryptorHandler   = encryptorHandler;
     _tokenHandler       = tokenHandler;
 }
Esempio n. 3
0
 public AuthenticateBusiness(IAdministratorBusiness administratorBusiness, IEncryptorHandler encryptorHandler,
                             ITokenHandler tokenHandler, IPermissionBusiness permissionBusiness)
 {
     _administratorBusiness = administratorBusiness;
     _permissionBusiness    = permissionBusiness;
     _encryptorHandler      = encryptorHandler;
     _tokenHandler          = tokenHandler;
 }
 /// <summary>
 /// 首页控制器构造函数
 /// </summary>
 /// <param name="homeBus"></param>
 /// <param name="permissionBus"></param>
 /// <param name="operator"></param>
 public HomeController(
     IHomeBusiness homeBus,
     IPermissionBusiness permissionBus,
     IOperator @operator
     )
 {
     _homeBus       = homeBus;
     _permissionBus = permissionBus;
     _operator      = @operator;
 }
Esempio n. 5
0
        public TestPermissionController()
        {
            _service = new PermissionBusinessFake();

            var mockMapper = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new AutoMapperProfile());
            });

            _mapper     = mockMapper.CreateMapper();
            _controller = new PermissionController(_service, _mapper);
        }
Esempio n. 6
0
 public HomeController(
     IHomeBusiness homeBus,
     IPermissionBusiness permissionBus,
     Imini_project_userBusiness mini_project_userBusiness,
     IBase_UserBusiness userBus,
     IOperator @operator
     )
 {
     _homeBus                   = homeBus;
     _permissionBus             = permissionBus;
     _mini_project_userBusiness = mini_project_userBusiness;
     _userBus                   = userBus;
     _operator                  = @operator;
 }
 public HomeController(
     IHomeBusiness homeBus,
     IPermissionBusiness permissionBus,
     IBase_UserBusiness userBus,
     IOperator @operator,
     IOptions <JwtOptions> jwtOptions
     )
 {
     _homeBus       = homeBus;
     _permissionBus = permissionBus;
     _userBus       = userBus;
     _operator      = @operator;
     _jwtOptions    = jwtOptions.Value;
 }
Esempio n. 8
0
        /// <summary>
        /// Action执行之前执行
        /// </summary>
        /// <param name="context">过滤器上下文</param>
        public async override Task OnActionExecuting(ActionExecutingContext context)
        {
            if (context.ContainsFilter <NoApiPermissionAttribute>())
            {
                return;
            }

            IPermissionBusiness permissionBus = AutofacHelper.GetScopeService <IPermissionBusiness>();
            var permissions = await permissionBus.GetUserPermissionValuesAsync(Operator.UserId);

            if (!permissions.Contains(_permissionValue))
            {
                context.Result = Error("权限不足!");
            }
        }
        /// <summary>
        /// Action执行之前执行
        /// </summary>
        /// <param name="context">过滤器上下文</param>
        public async override Task OnActionExecuting(ActionExecutingContext context)
        {
            if (context.ContainsFilter <NoApiPermissionAttribute>())
            {
                return;
            }
            IServiceProvider    serviceProvider = context.HttpContext.RequestServices;
            IPermissionBusiness _permissionBus  = serviceProvider.GetService <IPermissionBusiness>();
            IOperator           _operator       = serviceProvider.GetService <IOperator>();

            var permissions = await _permissionBus.GetUserPermissionValuesAsync(_operator.UserId);

            if (!permissions.Contains(_permissionValue))
            {
                context.Result = Error("权限不足!");
            }
        }
 public PermissionController(IPermissionBusiness permissionBusiness)
 {
     _permissionBusiness = permissionBusiness;
 }
Esempio n. 11
0
 public CustomerPermissionBusiness(ICustomerPermissionRepository customerPermissionRepository, IPermissionBusiness permissionBusiness)
 {
     _customerPermissionRepository = customerPermissionRepository;
     _permissionBusiness           = permissionBusiness;
 }
 public PermissionController(IPermissionBusiness permissionBusiness, IMapper mapper)
 {
     _permissionBusiness = permissionBusiness;
     _mapper             = mapper;
 }
Esempio n. 13
0
 public HomeController(IHomeBusiness homeBus, IPermissionBusiness permissionBus, IBase_UserBusiness userBus)
 {
     _homeBus       = homeBus;
     _permissionBus = permissionBus;
     _userBus       = userBus;
 }
 public PermissionAppService(IPermissionBusiness permissionBusiness)
 {
     this.permissionBusiness = permissionBusiness;
 }