Table of Contents

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

UserNoticeAudience

Kind

Which rule this is.

public UserNoticeAudienceKind Kind { get; }

Property Value

UserNoticeAudienceKind

MinimumAccessLevel

The least privileged access level admitted, for AccessLevel.

public AccessLevel? MinimumAccessLevel { get; }

Property Value

AccessLevel?

NamedOnly

Only the recipients the raiser names on each occurrence.

public static UserNoticeAudience NamedOnly { get; }

Property Value

UserNoticeAudience

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

Func<UserNoticeOccurrence, IServiceProvider, CancellationToken, Task<IEnumerable<string>>>

Role

The tenant role a member must hold, for Role.

public string Role { get; }

Property Value

string

Scope

The team scope a member must hold, for Scope.

public string Scope { get; }

Property Value

string

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

bool

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

minimum AccessLevel

Returns

UserNoticeAudience

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

accessLevel AccessLevel?
roles IEnumerable<string>
scopes IEnumerable<string>

Returns

bool

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

resolver Func<UserNoticeOccurrence, IServiceProvider, CancellationToken, Task<IEnumerable<string>>>

Returns

UserNoticeAudience

Exceptions

ArgumentNullException

The resolver is null.

WithRole(string)

Members holding the tenant role role in the team.

public static UserNoticeAudience WithRole(string role)

Parameters

role string

Returns

UserNoticeAudience

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

scope string

Returns

UserNoticeAudience

Exceptions

ArgumentException

The scope is empty.