public AuthenticationHandler(
            ILoggerFactory loggerFactory,
            ConventionSettings conventionSettings,
            AuthenticationSettings authenticationSettings,
            IEntityRepository <RegSysAlternativePinRecord> regSysAlternativePinRepository,
            IEntityRepository <RegSysIdentityRecord> regSysIdentityRepository,
            IEntityRepository <RegSysAccessTokenRecord> regSysAccessTokenRepository,
            ITokenFactory tokenFactory
            )
        {
            _logger                      = loggerFactory.CreateLogger(GetType());
            _conventionSettings          = conventionSettings;
            _authenticationSettings      = authenticationSettings;
            _regSysIdentityRepository    = regSysIdentityRepository;
            _regSysAccessTokenRepository = regSysAccessTokenRepository;
            _tokenFactory                = tokenFactory;

            _authenticationProviders =
                _conventionSettings.IsRegSysAuthenticationEnabled ?
                new IAuthenticationProvider[]
            {
                new RegSysAlternativePinAuthenticationProvider(regSysAlternativePinRepository),
                new RegSysCredentialsAuthenticationProvider()
            }
                    :
            new IAuthenticationProvider[]
            {
                new RegSysAlternativePinAuthenticationProvider(regSysAlternativePinRepository),
            };
        }
 public SettingsUpdateViewModel(string conId, ConventionSettings settings)
 {
     ConventionId            = conId;
     AllowEventsSuggestions  = settings.AllowEventsSuggestions;
     AllowEventsRegistration = settings.AllowEventsRegistration;
     AllowPayments           = settings.AllowPayments;
     AllowManagementTests    = settings.AllowManagementTests;
 }
        public void UpdateSettings(string convetionId, ConventionSettings settings)
        {
            var convention = Session.Load <Convention>(convetionId);

            convention.Settings = settings;
            Session.Store(convention);
            Session.SaveChanges();
        }
        public BotManager(
            TelegramConfiguration telegramConfiguration,
            IUserManager userManager,
            IDealerService dealerService,
            IEventService eventService,
            IEventConferenceRoomService eventConferenceRoomService,
            IRegSysAlternativePinAuthenticationProvider regSysAlternativePinAuthenticationProvider,
            IEntityRepository <PushNotificationChannelRecord> pushNotificationChannelRepository,
            IEntityRepository <FursuitBadgeRecord> fursuitBadgeRepository,
            IPrivateMessageService privateMessageService,
            ICollectingGameService collectingGameService,
            ConventionSettings conventionSettings,
            ILoggerFactory loggerFactory,
            ITelegramMessageBroker telegramMessageBroker
            )
        {
            _logger        = loggerFactory.CreateLogger(GetType());
            _userManager   = userManager;
            _dealerService = dealerService;
            _eventService  = eventService;
            _eventConferenceRoomService = eventConferenceRoomService;
            _regSysAlternativePinAuthenticationProvider = regSysAlternativePinAuthenticationProvider;
            _pushNotificationChannelRepository          = pushNotificationChannelRepository;
            _fursuitBadgeRepository = fursuitBadgeRepository;
            _privateMessageService  = privateMessageService;
            _collectingGameService  = collectingGameService;
            _conventionSettings     = conventionSettings;
            _telegramMessageBroker  = telegramMessageBroker;

            _botClient =
                string.IsNullOrEmpty(telegramConfiguration.Proxy)
                    ? new TelegramBotClient(telegramConfiguration.AccessToken)
                    : new TelegramBotClient(telegramConfiguration.AccessToken,
                                            new MiniProxy(telegramConfiguration.Proxy));

            _conversationManager = new ConversationManager(
                loggerFactory,
                _botClient,
                (chatId) => new AdminConversation(
                    _userManager,
                    _regSysAlternativePinAuthenticationProvider,
                    _pushNotificationChannelRepository,
                    _fursuitBadgeRepository,
                    privateMessageService,
                    _collectingGameService,
                    _conventionSettings,
                    loggerFactory
                    )
                );

            _botClient.OnMessage       += BotClientOnOnMessage;
            _botClient.OnCallbackQuery += BotClientOnOnCallbackQuery;

            _botClient.OnInlineQuery += BotClientOnOnInlineQuery;

            _telegramMessageBroker.OnSendMarkdownMessageToChatAsync += _telegramMessageBroker_OnSendMarkdownMessageToChatAsync;
        }
Exemplo n.º 5
0
 public FursuitBadgeService(
     ConventionSettings conventionSettings,
     IEntityRepository <FursuitBadgeRecord> fursuitBadgeRepository,
     IEntityRepository <FursuitBadgeImageRecord> fursuitBadgeImageRepository
     )
 {
     _conventionSettings          = conventionSettings;
     _fursuitBadgeRepository      = fursuitBadgeRepository;
     _fursuitBadgeImageRepository = fursuitBadgeImageRepository;
 }
 public ItemActivityService(
     ConventionSettings conventionSettings,
     IEntityRepository <ItemActivityRecord> itemActivityRepository,
     IPrivateMessageService privateMessageService
     )
 {
     _conventionSettings     = conventionSettings;
     _itemActivityRepository = itemActivityRepository;
     _privateMessageService  = privateMessageService;
 }
Exemplo n.º 7
0
        public AdminConversation(
            IUserManager userManager,
            IRegSysAlternativePinAuthenticationProvider regSysAlternativePinAuthenticationProvider,
            IEntityRepository <PushNotificationChannelRecord> pushNotificationChannelRepository,
            IEntityRepository <FursuitBadgeRecord> fursuitBadgeRepository,
            IPrivateMessageService privateMessageService,
            ICollectingGameService collectingGameService,
            ConventionSettings conventionSettings,
            ILoggerFactory loggerFactory
            )
        {
            _logger      = loggerFactory.CreateLogger(GetType());
            _userManager = userManager;
            _regSysAlternativePinAuthenticationProvider = regSysAlternativePinAuthenticationProvider;
            _pushNotificationChannelRepository          = pushNotificationChannelRepository;
            _fursuitBadgeRepository = fursuitBadgeRepository;
            _privateMessageService  = privateMessageService;
            _collectingGameService  = collectingGameService;
            _conventionSettings     = conventionSettings;

            _commands = new List <CommandInfo>()
            {
                new CommandInfo()
                {
                    Command            = "/pin",
                    Description        = "Create an alternative password for an attendee to login",
                    RequiredPermission = PermissionFlags.PinCreate,
                    CommandHandler     = CommandPinRequest
                },
                new CommandInfo()
                {
                    Command            = "/pinInfo",
                    Description        = "Show the pin & issue log for a given registration number",
                    RequiredPermission = PermissionFlags.PinQuery,
                    CommandHandler     = CommandPinInfo
                },
                new CommandInfo()
                {
                    Command            = "/users",
                    Description        = "Manage Users",
                    RequiredPermission = PermissionFlags.UserAdmin,
                    CommandHandler     = CommandUserAdmin
                }
                ,
                new CommandInfo()
                {
                    Command            = "/statistics",
                    Description        = "Show some statistics",
                    RequiredPermission = PermissionFlags.Statistics,
                    CommandHandler     = CommandStatistics
                },
                new CommandInfo()
                {
                    Command            = "/locate",
                    Description        = "Figure out if a given regNo is signed in on any device",
                    RequiredPermission = PermissionFlags.Locate,
                    CommandHandler     = CommandLocate
                },
                new CommandInfo()
                {
                    Command            = "/pm",
                    Description        = "Send a personal message to a specific RegNo",
                    RequiredPermission = PermissionFlags.SendPm,
                    CommandHandler     = CommandSendMessage
                },
                new CommandInfo()
                {
                    Command            = "/badgeChecksum",
                    Description        = "Calculate the checksum letter of a given reg no.",
                    RequiredPermission = PermissionFlags.BadgeChecksum,
                    CommandHandler     = CommandBadgeChecksum
                },
                new CommandInfo()
                {
                    Command            = "/fursuitBadgeById",
                    Description        = "Lookup fursuit badge (by id)",
                    RequiredPermission = PermissionFlags.CollectionGameAdmin,
                    CommandHandler     = CommandFursuitBadge
                },
                new CommandInfo()
                {
                    Command            = "/collectionGameRegisterFursuit",
                    Description        = "Register a fursuit for the game",
                    RequiredPermission = PermissionFlags.CollectionGameAdmin,
                    CommandHandler     = CommandCollectionGameRegisterFursuit
                },
                new CommandInfo()
                {
                    Command            = "/collectionGameUnban",
                    Description        = "Unban someone from the game",
                    RequiredPermission = PermissionFlags.CollectionGameAdmin,
                    CommandHandler     = CommandCollectionGameUnban
                }
            };
        }