Пример #1
0
 public AccountController(
     UserManager <User> userManager,
     SignInManager <User> signInManager,
     ILoggerFactory loggerFactory, IUserBlProvider userBlProvider, IConfiguration cfg) : base(cfg, userBlProvider)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = loggerFactory.CreateLogger <AccountController>();
 }
Пример #2
0
 public HomeController(
     SignInManager <User> signInManager, ILogger <HomeController> logger, IUserBlProvider userBlProvider, IConfiguration cfg) : base(cfg, userBlProvider)
 {
     _signInManager  = signInManager;
     _logger         = logger;
     _userBlProvider = userBlProvider;
     _cfg            = cfg;
     IndexModel      = new HomeIndexModel();
 }
Пример #3
0
        public static bool IsAuthorized(
            PermissionItem item,
            IUserBlProvider userBlProvider,
            IConfiguration cfg,
            HttpContext ctx)
        {
            if (item == PermissionItem.Guest)
            {
                return(true);
            }
            User user = null;

            user = userBlProvider.GetUser(ctx.User);

            if (user == null)
            {
                return(false);
            }
            switch (item)
            {
            case PermissionItem.Admin:
            {
                var isAdmin = user.UserRoles.Any(r => r.Role != null && r.Role.Name.Contains(Constants.Admin));
                return(isAdmin);
            }

            case PermissionItem.Member:
            {
                var isMember = user.UserRoles.Any(
                    r => r.Role != null && (r.Role.Name.Contains(Constants.Admin) || r.Role.Name.Contains(Constants.Member)));
                return(isMember);
            }
            }

            return(false);
        }
Пример #4
0
 public AttachmentController(IDeliveryBlProvider deliveryBlProvider, ISettingsBlProvider settingsBlProvider, IAttachmentBlProvider attachmentBlProvider, IConfiguration cfg, IUserBlProvider userBlProvider) : base(cfg, userBlProvider)
 {
     _settingsBlProvider   = settingsBlProvider;
     _attachmentBlProvider = attachmentBlProvider;
     IndexModel            = new AttachmentIndexModel();
 }
Пример #5
0
        public SettingsController(IJobSchedulerBlProvider jobSchedulerBlProvider,
                                  UserManager <User> userManager, ISettingsBlProvider settingsBlProvider, ILoggerFactory loggerFactory, IConfiguration cfg, IUserBlProvider userBlProvider) : base(cfg, userBlProvider)
        {
            _jobSchedulerBlProvider = jobSchedulerBlProvider;
            _userManager            = userManager;
            _settingsBlProvider     = settingsBlProvider;

            _logger    = loggerFactory.CreateLogger <SettingsController>();
            IndexModel = new SettingsModel();
        }
Пример #6
0
 public InvoiceController(IJobSchedulerBlProvider jobSchedulerBlProvider, IInvoiceBlProvider invoiceBlProvider, IConfiguration cfg, IUserBlProvider userBlProvider) : base(cfg, userBlProvider)
 {
     _jobSchedulerBlProvider = jobSchedulerBlProvider;
     _invoiceBlProvider      = invoiceBlProvider;
     IndexModel = new InvoiceIndexModel();
 }
Пример #7
0
 public CompletionController(IEmailSendGridBlProvider emailSendGridBlProvider, ICompletionBlProvider completionBlProvider, IConfiguration cfg, IUserBlProvider userBlProvider) : base(cfg, userBlProvider)
 {
     _emailSendGridBlProvider = emailSendGridBlProvider;
     _completionBlProvider    = completionBlProvider;
     IndexModel = new CompletionIndexModel();
 }
Пример #8
0
 public BaseController(IConfiguration cfg, IUserBlProvider userBlProvider)
 {
     Cfg            = cfg;
     UserBlProvider = userBlProvider;
 }
Пример #9
0
 public UserStore(IUserBlProvider blProvider)
 {
     _blProvider = blProvider;
 }
Пример #10
0
 public DeliveryController(IOrderBlProvider orderBlProvider, ISettingsBlProvider settingsBlProvider, IDeliveryBlProvider deliveryBlProvider, IConfiguration cfg, IUserBlProvider userBlProvider) : base(cfg, userBlProvider)
 {
     _orderBlProvider    = orderBlProvider;
     _settingsBlProvider = settingsBlProvider;
     _deliveryBlProvider = deliveryBlProvider;
     IndexModel          = new DeliveryIndexModel();
 }
Пример #11
0
 public OrderController(ISettingsBlProvider settingsBlProvider, IOrderBlProvider orderBlProvider, IConfiguration cfg, IUserBlProvider userBlProvider) : base(cfg, userBlProvider)
 {
     _settingsBlProvider = settingsBlProvider;
     _orderBlProvider    = orderBlProvider;
     IndexModel          = new OrderIndexModel();
 }