Interface IUserNoticePreferenceService
- Namespace
- Tharga.Team
- Assembly
- Tharga.Team.dll
Which automatic notices a user receives and how, read and changed by that user or by staff holding Manage.
public interface IUserNoticePreferenceService
Remarks
Checked in the service, not by scope attributes, because the rule is "your own, or any with
users:manage", which a scope alone cannot say; a refused change is audited.
A choice follows the user, not the team. One person has one inbox, so a choice made once applies in every team they are a member of. Until they choose, each team's default applies to that team's notices, then the catalogue's. Only a choice that differs from a default in force for them is stored.
Methods
GetChoicesAsync(string, CancellationToken)
The user's choice for every notice they may receive in any of their teams, in catalogue order.
Task<UserNoticeChoice[]> GetChoicesAsync(string userKey, CancellationToken cancellationToken = default)
Parameters
userKeystringcancellationTokenCancellationToken
Returns
Exceptions
- UnauthorizedAccessException
The caller is not this user and does not hold
users:manage.
SetChoiceAsync(string, string, bool, UserNoticeDelivery, CancellationToken)
Records whether the user receives a notice and how, audited when it changes, and returns the choice now in force.
Task<UserNoticeChoice> SetChoiceAsync(string userKey, string noticeKey, bool enabled, UserNoticeDelivery delivery, CancellationToken cancellationToken = default)
Parameters
userKeystringnoticeKeystringenabledbooldeliveryUserNoticeDeliverycancellationTokenCancellationToken
Returns
Exceptions
- ArgumentException
The notice is not in the catalogue, or it does not allow
delivery.- UnauthorizedAccessException
The caller is not this user and does not hold
users:manage.