Consent Service
What is a Consent
Register a new consent
Get the current state
Revoking a consent
Examples
// 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
Was this helpful?