Esempio n. 1
0
        public ActionResult Revoke()
        {
            // Gets the related tracking consent
            ConsentInfo consent = ConsentInfoProvider.GetConsentInfo("SampleTrackingConsent");

            // Gets the current contact and revokes the tracking consent agreement
            ContactInfo currentContact = ContactManagementContext.GetCurrentContact();

            consentAgreementService.Revoke(currentContact, consent);

            // Sets the visitor's cookie level to the site's default cookie level (disables contact tracking)
            int defaultCookieLevel = currentCookieLevelProvider.GetDefaultCookieLevel();

            currentCookieLevelProvider.SetCurrentCookieLevel(defaultCookieLevel);

            return(RedirectToAction("DisplayConsent"));
        }
Esempio n. 2
0
        public ActionResult Revoke(int consentId)
        {
            // Gets the related consent object
            ConsentInfo consent = ConsentInfoProvider.GetConsentInfo(consentId);

            // Gets the current visitor's contact
            ContactInfo currentContact = contactTrackingService.GetCurrentContactAsync(User.Identity.Name).Result;

            // For the tracking consent, lowers the cookie level to the site's default in order to disable tracking
            if (consent.ConsentName == "SampleTrackingConsent")
            {
                currentCookieLevelProvider.SetCurrentCookieLevel(currentCookieLevelProvider.GetDefaultCookieLevel());
            }

            // Revokes the consent agreement
            consentAgreementService.Revoke(currentContact, consent);

            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public ActionResult Revoke(string consentName)
        {
            var consentToRevoke = consentInfoProvider.Get(consentName);

            if (consentToRevoke != null && CurrentContact != null)
            {
                consentAgreementService.Revoke(CurrentContact, consentToRevoke);

                if (consentName == TrackingConsentGenerator.CONSENT_NAME)
                {
                    cookieLevelProvider.SetCurrentCookieLevel(cookieLevelProvider.GetDefaultCookieLevel());
                    ExecuteRevokeTrackingConsentTask(siteService.CurrentSite, CurrentContact);
                }

                TempData[SUCCESS_RESULT] = true;
            }
            else
            {
                TempData[ERROR_RESULT] = true;
            }

            return(Redirect(Url.Kentico().PageUrl(ContentItemIdentifiers.PRIVACY)));
        }
        public ActionResult Revoke(string consentName)
        {
            var consentToRevoke = ConsentInfoProvider.GetConsentInfo(consentName);

            if (consentToRevoke != null && CurrentContact != null)
            {
                mConsentAgreementService.Revoke(CurrentContact, consentToRevoke);

                if (consentName == TrackingConsentGenerator.CONSENT_NAME)
                {
                    mCookieLevelProvider.SetCurrentCookieLevel(mCookieLevelProvider.GetDefaultCookieLevel());
                    ExecuteRevokeTrackingConsentTask(mSiteService.CurrentSite, CurrentContact);
                }

                TempData[SUCCESS_RESULT] = true;
            }
            else
            {
                TempData[ERROR_RESULT] = true;
            }

            return(RedirectToAction("Index"));
        }