Example #1
0
        public object Any(UnRegisterEventSubscriber request)
        {
            var subscription = ServerEvents.GetSubscriptionInfo(request.Id);

            if (subscription == null)
            {
                throw HttpError.NotFound(ErrorMessages.SubscriptionNotExistsFmt.Fmt(request.Id));
            }

            ServerEvents.UnRegister(subscription.SubscriptionId);

            return(subscription.Meta);
        }
Example #2
0
        public object Any(UnRegisterEventSubscriber request)
        {
            var subscription = ServerEvents.GetSubscriptionInfo(request.Id);

            if (subscription == null)
            {
                throw HttpError.NotFound("Subscription '{0}' does not exist.".Fmt(request.Id));
            }

            ServerEvents.UnRegister(subscription.SubscriptionId);

            return(subscription.Meta);
        }
        public object Any(UnRegisterEventSubscriber request)
        {
            var subscription = ServerEvents.GetSubscriptionInfo(request.Id);

            if (subscription == null)
            {
                throw HttpError.NotFound(ErrorMessages.SubscriptionNotExistsFmt.Fmt(request.Id));
            }

            var feature = HostContext.GetPlugin <ServerEventsFeature>();

            if (!feature.CanAccessSubscription(base.Request, subscription))
            {
                throw HttpError.Forbidden(ErrorMessages.SubscriptionForbiddenFmt.Fmt(request.Id));
            }

            ServerEvents.UnRegister(subscription.SubscriptionId);

            return(subscription.Meta);
        }