Class PolicyRequirement
Represents a requirement that must be fulfilled before a mutation can proceed.
Inherited Members
Namespace: ModularityKit.Mutator.Abstractions.Policies
Assembly: ModularityKit.Mutator.dll
Syntax
public sealed class PolicyRequirement
Remarks
Policy requirements are used in conjunction with PolicyDecision to enforce governance rules such as approvals, additional authentication, or compliance checks.
Key points:
- Type identifies the kind of requirement (e.g., "Approval", "TwoFactor").
- Description provides a human-readable explanation of the requirement.
- Data can carry structured information relevant to the requirement.
- IsFulfilled indicates whether the requirement has already been satisfied.
Properties
| Edit this page View SourceData
Optional structured data associated with the requirement.
Declaration
public object? Data { get; init; }
Property Value
| Type | Description |
|---|---|
| object |
Description
Human-readable description of the requirement.
Declaration
public string Description { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
IsFulfilled
Indicates whether the requirement has been fulfilled.
Declaration
public bool IsFulfilled { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |
Type
Type of the requirement (e.g., "Approval", "TwoFactor").
Declaration
public string Type { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceApproval(string, string)
Creates an approval requirement specifying who must approve and why.
Declaration
public static PolicyRequirement Approval(string approver, string reason)
Parameters
| Type | Name | Description |
|---|---|---|
| string | approver | Identifier of the approver (e.g., email or username). |
| string | reason | Reason for requiring approval. |
Returns
| Type | Description |
|---|---|
| PolicyRequirement | A policy requirement representing an approval step. |
TwoFactor()
Creates a two-factor authentication requirement.
Declaration
public static PolicyRequirement TwoFactor()
Returns
| Type | Description |
|---|---|
| PolicyRequirement | A policy requirement representing a 2FA step. |