Skip to content

Commit 5475c61

Browse files
committed
Document PAM domain entities, enums, and read-model fields
Add XML doc comments to the AccessRequest/AccessLease/AccessDecision entities, their status/verdict/kind enum members, and the denormalized identity fields on the AccessRequestDetails read model. Documents the non-obvious semantics (nullability, lifecycle, granted vs requested window) while leaving plain ids and straight projections bare.
1 parent ce517c6 commit 5475c61

8 files changed

Lines changed: 70 additions & 0 deletions

File tree

src/Pam.Domain/Entities/AccessDecision.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ public class AccessDecision : ITableObject<Guid>
1313
{
1414
public Guid Id { get; set; }
1515

16+
/// <summary>
17+
/// The request this decision was made on.
18+
/// </summary>
1619
public Guid AccessRequestId { get; set; }
1720

21+
/// <summary>
22+
/// Discriminates the decision: determines whether <see cref="ApproverId"/> or <see cref="ConditionKind"/> is populated.
23+
/// </summary>
1824
public AccessDeciderKind DeciderKind { get; set; }
1925

2026
/// <summary>
@@ -28,6 +34,9 @@ public class AccessDecision : ITableObject<Guid>
2834
/// </summary>
2935
public AccessConditionKind? ConditionKind { get; set; }
3036

37+
/// <summary>
38+
/// The approve-or-deny outcome recorded by this decision.
39+
/// </summary>
3140
public AccessDecisionVerdict Verdict { get; set; }
3241

3342
/// <summary>
@@ -40,6 +49,9 @@ public class AccessDecision : ITableObject<Guid>
4049
/// </summary>
4150
public string? EvaluationContext { get; set; }
4251

52+
/// <summary>
53+
/// When the decision was recorded, stamped in UTC at construction.
54+
/// </summary>
4355
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
4456

4557
public void SetNewId()

src/Pam.Domain/Entities/AccessLease.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,35 @@ public class AccessLease : ITableObject<Guid>
2323
public Guid CipherId { get; set; }
2424
public Guid RequesterId { get; set; }
2525

26+
/// <summary>
27+
/// The lease's position in its lifecycle. Only an <see cref="AccessLeaseStatus.Active"/> lease within its window
28+
/// authorizes access.
29+
/// </summary>
2630
public AccessLeaseStatus Status { get; set; }
31+
32+
/// <summary>
33+
/// The start of the granted access window, carried over from the approved <see cref="AccessRequest"/>.
34+
/// </summary>
2735
public DateTime NotBefore { get; set; }
36+
37+
/// <summary>
38+
/// The end of the granted access window.
39+
/// </summary>
2840
public DateTime NotAfter { get; set; }
2941

42+
/// <summary>
43+
/// Set when an operator revokes the lease (<see cref="AccessLeaseStatus.Revoked"/>). NULL otherwise.
44+
/// </summary>
3045
public DateTime? RevokedDate { get; set; }
46+
47+
/// <summary>
48+
/// The operator who revoked the lease. NULL unless <see cref="Status"/> is <see cref="AccessLeaseStatus.Revoked"/>.
49+
/// </summary>
3150
public Guid? RevokedBy { get; set; }
3251

52+
/// <summary>
53+
/// When the lease was minted, stamped in UTC at construction.
54+
/// </summary>
3355
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
3456

3557
public void SetNewId()

src/Pam.Domain/Entities/AccessRequest.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ public class AccessRequest : ITableObject<Guid>
4949
/// </summary>
5050
public string? Reason { get; set; }
5151

52+
/// <summary>
53+
/// The request's position in its lifecycle. Created <see cref="AccessRequestStatus.Pending"/> for human approval or
54+
/// already <see cref="AccessRequestStatus.Approved"/> for automatic approval, then settling in one terminal state.
55+
/// </summary>
5256
public AccessRequestStatus Status { get; set; }
57+
58+
/// <summary>
59+
/// When the request was submitted, stamped in UTC at construction.
60+
/// </summary>
5361
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
5462

5563
/// <summary>

src/Pam.Domain/Enums/AccessConditionKind.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
/// </summary>
88
public enum AccessConditionKind : byte
99
{
10+
/// <summary>Requires a human approver; matching requests are routed for manual approval rather than auto-decided.</summary>
1011
HumanApproval = 0,
12+
13+
/// <summary>Matches when the requester's IP is on a configured allowlist.</summary>
1114
IpAllowlist = 1,
15+
16+
/// <summary>Matches when the request falls within a configured time-of-day window.</summary>
1217
TimeOfDay = 2,
1318
}

src/Pam.Domain/Enums/AccessDeciderKind.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
/// </summary>
66
public enum AccessDeciderKind : byte
77
{
8+
/// <summary>A condition on the governing access rule decided, with no human involved.</summary>
89
Automatic = 0,
10+
11+
/// <summary>A human approver decided.</summary>
912
Human = 1,
1013
}
1114

@@ -14,6 +17,9 @@ public enum AccessDeciderKind : byte
1417
/// </summary>
1518
public enum AccessDecisionVerdict : byte
1619
{
20+
/// <summary>Access was refused.</summary>
1721
Deny = 0,
22+
23+
/// <summary>Access was granted.</summary>
1824
Approve = 1,
1925
}

src/Pam.Domain/Enums/AccessLeaseStatus.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
/// </summary>
66
public enum AccessLeaseStatus : byte
77
{
8+
/// <summary>Live; within its window it authorizes access.</summary>
89
Active = 0,
10+
11+
/// <summary>The lease's window ended on its own.</summary>
912
Expired = 1,
13+
14+
/// <summary>An operator ended the lease early.</summary>
1015
Revoked = 2,
1116

1217
/// <summary>The holder ended their own lease early, as opposed to <see cref="Revoked"/> (an operator ended it).</summary>

src/Pam.Domain/Enums/AccessRequestStatus.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66
/// </summary>
77
public enum AccessRequestStatus : byte
88
{
9+
/// <summary>Awaiting a human approver's decision.</summary>
910
Pending = 0,
11+
12+
/// <summary>Approved automatically or by an approver; the requester can activate it into a lease within its window.</summary>
1013
Approved = 1,
14+
15+
/// <summary>An approver refused the request.</summary>
1116
Denied = 2,
17+
18+
/// <summary>Withdrawn by the requester before it was decided.</summary>
1219
Cancelled = 3,
20+
21+
/// <summary>The approval window lapsed with no decision recorded.</summary>
1322
ExpiredUnanswered = 4,
1423
}

src/Pam.Domain/Models/AccessRequestDetails.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public class AccessRequestDetails
4747
/// </summary>
4848
public List<AccessRequestDecision> Decisions { get; set; } = new();
4949

50+
/// <summary>The requester's display name, denormalized from the User join; null when unset or the user could not be resolved.</summary>
5051
public string? RequesterName { get; set; }
52+
53+
/// <summary>The requester's email, the fallback display when <see cref="RequesterName"/> is unset.</summary>
5154
public string? RequesterEmail { get; set; }
5255
}

0 commit comments

Comments
 (0)