Class AuditedAttribute
- Namespace
- FishMMO.ControlPanel.Services
- Assembly
- FishMMO-ControlPanel.dll
Names the audit action an endpoint records.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class AuditedAttribute : Attribute
- Inheritance
-
AuditedAttribute
- Inherited Members
Remarks
Declarative rather than a call inside the method, because a call is something an author can forget and an attribute is something a startup check can enumerate. See AuditCoverage: the panel refuses to start in development if a privileged write endpoint has no attribute, so the mistake is caught at the first run rather than discovered later as a hole in the record.
Applying this is not what causes the row to be written — AuditActionFilter writes a row for every privileged write whether or not the attribute is present. The attribute is what makes the row good: a stable action name that queries and retention rules can be written against, rather than one derived from a controller name that a rename would silently change.
Constructors
AuditedAttribute(string)
Creates the attribute.
public AuditedAttribute(string action)
Parameters
actionstringThe stable dotted action identifier.
Properties
Action
The stable dotted action identifier, such as account.ban.
public string Action { get; }
Property Value
TargetRouteValue
The route value naming the target, such as id or username.
public string TargetRouteValue { get; init; }
Property Value
Remarks
Read from the route rather than the body so that a request which fails model binding, or one whose body names a different target than its URL, still records the target the authorization check was actually made against.
TargetType
What kind of thing is acted on: account, character.
public string TargetType { get; init; }