| | | 1 | | using Elsa.Mediator.Contracts; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Identity.Notifications; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Safe context shared by role and assignment security notifications. It deliberately carries no secret, |
| | | 7 | | /// credential, or token: these are published for audit subscribers, and this module owns no audit store. |
| | | 8 | | /// </summary> |
| | | 9 | | /// <param name="ActorId">Who performed the change, where the caller is identifiable.</param> |
| | | 10 | | /// <param name="TenantId">The tenant the change applies to.</param> |
| | | 11 | | public sealed record RoleSecurityEventContext( |
| | | 12 | | string? ActorId, |
| | | 13 | | string? TenantId, |
| | | 14 | | DateTimeOffset OccurredAt, |
| | | 15 | | string Summary); |
| | | 16 | | |
| | | 17 | | /// <summary>Published when a role is created, updated, or deleted.</summary> |
| | | 18 | | /// <param name="Operation">One of <c>created</c>, <c>updated</c>, or <c>deleted</c>.</param> |
| | | 19 | | /// <param name="Permissions"> |
| | | 20 | | /// The resulting grants, so a reviewer can reconstruct what a role conferred at a point in time without |
| | | 21 | | /// replaying every prior event. |
| | | 22 | | /// </param> |
| | 4 | 23 | | public sealed record RoleChanged( |
| | 0 | 24 | | RoleSecurityEventContext Context, |
| | 4 | 25 | | string Operation, |
| | 4 | 26 | | string RoleId, |
| | 4 | 27 | | string RoleName, |
| | 8 | 28 | | IReadOnlyCollection<string> Permissions) : INotification; |
| | | 29 | | |
| | | 30 | | /// <summary>Published when roles are assigned to or removed from a user.</summary> |
| | | 31 | | /// <param name="Assigned">Role identifiers added by this change.</param> |
| | | 32 | | /// <param name="Removed">Role identifiers withdrawn by this change.</param> |
| | | 33 | | public sealed record UserRoleAssignmentChanged( |
| | | 34 | | RoleSecurityEventContext Context, |
| | | 35 | | string UserId, |
| | | 36 | | IReadOnlyCollection<string> Assigned, |
| | | 37 | | IReadOnlyCollection<string> Removed) : INotification; |