Table of Contents

Method RequireAnyPermission

Namespace
MailFathom.Application.Access
Assembly
MailFathom.Application.dll

RequireAnyPermission(MailFathomPermission, MailFathomPermission)

Requires that an admitted caller holding either of two named capabilities is what reached this use case.

public void RequireAnyPermission(MailFathomPermission first, MailFathomPermission second)

Parameters

first MailFathomPermission

One capability the operation is published under.

second MailFathomPermission

The other capability the operation is published under.

Remarks

This is for a use case two surfaces perform, where each publishes the act under a name of its own. The surfaces draw from disjoint halves, so a caller admitted by one of them can never hold the other's name however broadly it is granted — requiring a single permission there would mean the use case was reachable from one entrypoint and dead from the other. Writing the contact book is the case: an operator reaches it under AdminOperate and an agent under MailContactsWrite, and the act is the same act.

It is an alternative rather than a widening, so it is written where the act genuinely belongs to both surfaces and nowhere else. An act only one of them performs keeps RequirePermission(MailFathomPermission), which is why promoting a collected contact and exporting one stay named for the administrative surface alone.

A refusal names the alternative belonging to the surface the caller's own grant is written on, so an operator diagnosing one is told the name they could have granted rather than the one from the half they cannot reach. A caller granted nothing at all has no surface to read, and is told first.

Exceptions

ArgumentException

Thrown when either argument names no published capability, which is a defect in the calling use case rather than a refusal.

PrincipalNotAuthorizedException

Thrown when the work was reached under no principal, under a principal that is not a caller, or by a caller whose grant omits both capabilities.