Esempio n. 1
0
        public CurrentAdmin(ISystemAdminService systemAdminService, IAdminActionService adminActionService, AdminCacheService adminCacheService)
        {
            this._systemAdminService = systemAdminService;
            this._adminActionService = adminActionService;
            this._adminCacheService  = adminCacheService;

            if (!HttpContext.Current.User.Identity.IsAuthenticated) //WCF use OperationContext.Current
            {
                throw new AuthenticationException("账户未登录");         //必须要用户Form验证后才能使用CurrentAdmin
            }
            FormsAuthenticationTicket ticket = (HttpContext.Current.User.Identity as FormsIdentity).Ticket;

            string[] userInfo = ticket.UserData.Split(';');

            //从缓存中取得当前登录用户信息,缓存无,则从数据库取得
            string SAName = ticket.Name;

            AdminInfo = _adminCacheService.GetCache <SystemAdmin>(AdminCacheService.SysAdmin_Current_prefix + SAName);
            if (AdminInfo == null)
            {
                AdminInfo = systemAdminService.GetByCondition(new DirectSpecification <SystemAdmin>(x => x.SAName == SAName), true);
                _adminCacheService.Add <SystemAdmin>(AdminCacheService.SysAdmin_Current_prefix + SAName, AdminInfo, TimeSpan.FromHours(2));
            }


            AdminRoles = AdminInfo.AdminRoles;

            LoginedIP = userInfo[1];
        }
Esempio n. 2
0
 public AdminRoleController(IAdminRoleService adminRoleService, IAdminModuleService adminModuleService, IAdminRole_ModuleService adminRole_ModuleService, IAdminActionService adminActionService, CurrentAdmin currentAdmin)
 {
     this._adminRoleService        = adminRoleService;
     this._adminModuleService      = adminModuleService;
     this._adminRole_ModuleService = adminRole_ModuleService;
     this._adminActionService      = adminActionService;
     _currentAdmin = currentAdmin;
 }
Esempio n. 3
0
 public PremiumAccountManager(IDatabase database, ICharacterService characterService,
                              IReadOnlyUserService userService, IPurchaseService purchaseService, IAdminActionService adminActionService,
                              IEmailSender emailSender, IMtaManager mtaManager, IOrderService orderService,
                              IPremiumUserLibraryManager premiumUserLibraryManager, ITempDatabaseCleaner tempDatabaseCleaner,
                              IFilesManager filesManager, ICustomInteriorManager customInteriorManager,
                              IHttpContextReader httpContextReader)
 {
     this.database                  = database;
     this.characterService          = characterService;
     this.userService               = userService;
     this.purchaseService           = purchaseService;
     this.adminActionService        = adminActionService;
     this.emailSender               = emailSender;
     this.mtaManager                = mtaManager;
     this.orderService              = orderService;
     this.premiumUserLibraryManager = premiumUserLibraryManager;
     this.tempDatabaseCleaner       = tempDatabaseCleaner;
     this.filesManager              = filesManager;
     this.customInteriorManager     = customInteriorManager;
     this.httpContextReader         = httpContextReader;
 }
Esempio n. 4
0
 public AdminActionController(IAdminActionService adminActionService, CurrentAdmin currentAdmin)
 {
     this._adminActionService = adminActionService;
     _currentAdmin            = currentAdmin;
 }