Class UserNoticeAudience
- Namespace
- Tharga.Team
- Assembly
- Tharga.Team.dll
Who may receive a notice: the active members of the occurrence's team a rule admits, beside anyone the raiser names.
public sealed record UserNoticeAudience : IEquatable<UserNoticeAudience>
- Inheritance
-
UserNoticeAudience
- Implements
- Inherited Members
Remarks
The rule is evaluated per team, against each member's access level, tenant roles and effective team scopes in the team the occurrence belongs to. Recipients the raiser names are added to whoever the rule admits, and every recipient must be an active member of that team: accepted, not suspended, with a user record that is not disabled.
A member with no access level holds nothing since 4.0, so a scope, role or access-level rule never admits them; EveryMember does, and so does naming them.
A notice whose recipients are named or resolved per occurrence is offered on the profile of every active member, because any of them could be the one it reaches.
Properties
EveryMember
Every active member of the team.
public static UserNoticeAudience EveryMember { get; }
Property Value
Kind
Which rule this is.
public UserNoticeAudienceKind Kind { get; }
Property Value
MinimumAccessLevel
The least privileged access level admitted, for AccessLevel.
public AccessLevel? MinimumAccessLevel { get; }
Property Value
NamedOnly
Only the recipients the raiser names on each occurrence.
public static UserNoticeAudience NamedOnly { get; }
Property Value
Resolver
The callback naming an occurrence's recipients by user key, for Resolved; host-side only and never serialized.
[JsonIgnore]
public Func<UserNoticeOccurrence, IServiceProvider, CancellationToken, Task<IEnumerable<string>>> Resolver { get; }
Property Value
Role
The tenant role a member must hold, for Role.
public string Role { get; }
Property Value
Scope
The team scope a member must hold, for Scope.
public string Scope { get; }
Property Value
SelectsByMembership
Whether the rule chooses recipients from the team's members by what each holds, rather than by name or callback.
public bool SelectsByMembership { get; }
Property Value
Methods
AtLeast(AccessLevel)
Members at minimum or a more privileged level in the team; Custom is admitted only by itself.
public static UserNoticeAudience AtLeast(AccessLevel minimum)
Parameters
minimumAccessLevel
Returns
MayReceive(AccessLevel?, IEnumerable<string>, IEnumerable<string>)
Whether a member holding this level, these roles and these effective scopes may receive the notice in their team; a null level is admitted only by every member or a named or resolved rule.
public bool MayReceive(AccessLevel? accessLevel, IEnumerable<string> roles, IEnumerable<string> scopes)
Parameters
accessLevelAccessLevel?rolesIEnumerable<string>scopesIEnumerable<string>
Returns
ResolvedBy(Func<UserNoticeOccurrence, IServiceProvider, CancellationToken, Task<IEnumerable<string>>>)
The user keys resolver returns for each occurrence, from a scope of the host's services.
public static UserNoticeAudience ResolvedBy(Func<UserNoticeOccurrence, IServiceProvider, CancellationToken, Task<IEnumerable<string>>> resolver)
Parameters
resolverFunc<UserNoticeOccurrence, IServiceProvider, CancellationToken, Task<IEnumerable<string>>>
Returns
Exceptions
- ArgumentNullException
The resolver is null.
WithRole(string)
Members holding the tenant role role in the team.
public static UserNoticeAudience WithRole(string role)
Parameters
rolestring
Returns
Exceptions
- ArgumentException
The role is empty.
WithScope(string)
Members holding scope in the team, through their access level, roles or scope overrides.
public static UserNoticeAudience WithScope(string scope)
Parameters
scopestring
Returns
Exceptions
- ArgumentException
The scope is empty.