Class SubjectConsentService<TKey>
- Namespace
- Dynamicweb.DataProcessing
- Assembly
- Dynamicweb.Core.dll
Base class for handling consents for a specific subject type (user, visitor, etc.)
public abstract class SubjectConsentService<TKey> where TKey : IConvertible, IComparable
Type Parameters
TKey
The type of the subject identifier.
- Inheritance
-
SubjectConsentService<TKey>
- Derived
- Inherited Members
Methods
GetConsent(string)
Gets a consent to an activity for the current subject.
public Consent? GetConsent(string activityId)
Parameters
activityId
stringThe activity identifier.
Returns
- Consent
A consent, if found; otherwise null.
GetConsent(string, TKey?)
Gets a consent to an activity for a given subject.
public Consent? GetConsent(string activityId, TKey? subjectId)
Parameters
activityId
stringThe activity identifier.
subjectId
TKeyThe subject identifier.
Returns
- Consent
A consent, if found; otherwise
null
.
GetConsents()
Gets all consents for the current subject.
public ICollection<Consent> GetConsents()
Returns
- ICollection<Consent>
A collection of consents.
GetConsents(TKey?)
Gets all consents for a given subject.
public ICollection<Consent> GetConsents(TKey? subjectId)
Parameters
subjectId
TKeyThe subject identifier.
Returns
- ICollection<Consent>
A collection of consents.
GetCurrentSubjectId()
Gets the current subject identifier.
protected abstract TKey? GetCurrentSubjectId()
Returns
- TKey
An identifier.
GiveConsent(string)
Gives consent to an activity for the current subject.
public void GiveConsent(string activityId)
Parameters
activityId
stringThe activity identifier.
GiveConsent(string, TKey?)
Gives a consent to an activity for a given subject.
public void GiveConsent(string activityId, TKey? subjectId)
Parameters
activityId
stringThe activity identifier.
subjectId
TKeyThe subject identifier.
IsConsentGiven(string)
Determines whether consent is given to the specified activity for the current subject.
public bool IsConsentGiven(string activityId)
Parameters
activityId
stringThe activity identifier.
Returns
- bool
true
if consent is given to the specified activity; otherwise,false
.
IsConsentGiven(string, TKey?)
Determines whether consent is given to the specified activity for a given subject.
public bool IsConsentGiven(string activityId, TKey? subjectId)
Parameters
activityId
stringThe activity identifier.
subjectId
TKeyThe subject identifier.
Returns
- bool
true
if consent is given to the specified activity; otherwise,false
.
WithdrawConsent(string)
Withdraws a consent to an activity for the current subject.
public void WithdrawConsent(string activityId)
Parameters
activityId
stringThe activity identifier.
WithdrawConsent(string, TKey?)
Withdraws a consent to an activity for a given subject.
public void WithdrawConsent(string activityId, TKey? subjectId)
Parameters
activityId
stringThe activity identifier.
subjectId
TKeyThe subject identifier.