Applies to Umbraco 9 and newer
Browse the API documentation for ConsentService.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
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".
In Razor views, you can access the consent service through the @inject
directive: