A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.umbraco.com/umbraco-cms/reference/management/using-services/consentservice below:

Consent Service | Umbraco CMS

Consent Service | Umbraco CMS
  1. Reference
  2. Management
  3. Using Umbraco services
Consent Service

A service for handling lawful data processing requirements.

A consent is fully identified by a source (whoever is consenting), a context (for example, an application), and an action (whatever is consented). A consent state registers the state of the consent (granted, revoked...).

Consent can be given or revoked or changed via the RegisterConsent method, which creates a new Consent entity to track the consent.

Getter methods of this service return the current state of a consent, that is the latest IConsent entity that was created.

Revoking a consent is performed by registering a revoked consent.

A consent cannot be deleted. It can only be revoked by registering a "revoked consent".

// store a new consent
var newConsent = _consentService.RegisterConsent("userId", "Our.Custom.Umbraco.Plugin", "AllowedToEmail", ConsentState.Granted, "some comments");

// lookup a consent
var consents = _consentService.LookupConsent("userId", "Our.Custom.Umbraco.Plugin", "AllowedToEmail", sourceStartsWith : true);
if (consents != null && consents.Any())
{
    var currentConsent = consents.First(c => c.Current == true);
    if(currentConsent.State  == ConsentState.Granted)
    {
        // Do what you need
    }
    else
    {
        // the state is None, Pending or Revoked
    }
}

Last updated 4 months ago


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4