Method RequireUser
- Namespace
- MailFathom.Application.Access
- Assembly
- MailFathom.Application.dll
RequireUser()
Requires that the work in hand is being done for one user, and answers which.
public UserId RequireUser()
Returns
- UserId
The user whose mail this unit of work may act on.
Remarks
This is the second axis of an access decision and it is asked separately from the first, because the two answer different questions: a permission says what the work may do and this says whose mail it may do it to. A use case that reads or writes somebody's mail asks both, and asking this one is what turns "acting for nobody" into a refusal rather than into an unbounded read.
It admits every kind of principal that carries a user rather than naming one kind, because a capability redeemed for a user's own attachment is acting for that user exactly as the caller who minted it was. What is refused is a principal with no user at all: this process's own identity, and the deployment administrator whose acts are the deployment's rather than one person's.
Exceptions
- PrincipalNotAuthorizedException
Thrown when the work was reached under no principal, or under one acting for no user.