コード例 #1
0
        internal void RequestSubscription(IInteractor subscriber, SubscriptionRequest subscriptionRequest)
        {
            if (!subscriber.HasRole(subscriptionRequest.Feed, Role.Subscribe))
            {
                Log.Warn($"Rejected request from {subscriber} to subscribe to feed \"{subscriptionRequest.Feed}\"");
                return;
            }

            Log.Debug($"Received subscription from {subscriber} on \"{subscriptionRequest}\"");

            if (subscriptionRequest.IsAdd)
            {
                _interactorManager.RequestAuthorisation(subscriber, subscriptionRequest.Feed, subscriptionRequest.Topic);
            }
            else
            {
                _repository.RemoveSubscription(subscriber, subscriptionRequest.Feed, subscriptionRequest.Topic, false);
                _notificationManager.ForwardSubscription(subscriber, subscriptionRequest);
            }
        }