Skip to content

Commit 0e00bac

Browse files
authored
Merge pull request #619 from nofrixion/feature/MOOV-4708-roleevents-2
MOOV-4708: Add Events to Roles
2 parents 56a25c1 + ff523d7 commit 0e00bac

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// -----------------------------------------------------------------------------
2+
// Filename: RoleEventTypeEnum.cs
3+
//
4+
// Description: List of the types of events that can occur in a role:
5+
//
6+
// Author(s):
7+
// Axel Granillo ([email protected])
8+
//
9+
// History:
10+
// 17 07 2025 Axel Granillo Created, Remote, Mexico City, Mexico.
11+
//
12+
// License:
13+
// MIT.
14+
// -----------------------------------------------------------------------------
15+
16+
namespace NoFrixion.MoneyMoov.Enums;
17+
18+
/// <summary>
19+
/// Events that can occur in a role.
20+
/// </summary>
21+
public enum RoleEventTypeEnum
22+
{
23+
None = 0,
24+
25+
Created = 1,
26+
27+
Edited = 2,
28+
29+
Archived = 3,
30+
31+
Unarchived = 4,
32+
33+
AssignedToUser = 5,
34+
35+
RemovedFromUser = 6,
36+
37+
UpdatedUserAssignment = 7
38+
}

src/NoFrixion.MoneyMoov/Models/Roles/Role.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ public class Role
3838
public List<RoleUser>? Users { get; set; }
3939

4040
public bool IsSystemRole { get; set; }
41+
42+
public List<RoleEvent> Events { get; set; } = null!;
4143
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// -----------------------------------------------------------------------------
2+
// Filename: RoleEvent.cs
3+
//
4+
// Description: A model that represents an event produced by a MoneyMoov
5+
// Role execution.
6+
//
7+
// Author(s):
8+
// Axel Granillo ([email protected])
9+
//
10+
// History:
11+
// 18 07 2025 Axel Granillo Created, Remote, Mexico City, Mexico.
12+
//
13+
// License:
14+
// MIT.
15+
// -----------------------------------------------------------------------------
16+
17+
using NoFrixion.Common.Permissions;
18+
using NoFrixion.MoneyMoov.Enums;
19+
20+
namespace NoFrixion.MoneyMoov.Models;
21+
22+
/// <summary>
23+
/// A model that represents an event produced by a MoneyMoov Role execution.
24+
/// </summary>
25+
public class RoleEvent
26+
{
27+
public Guid ID { get; set; }
28+
29+
public Guid RoleID { get; set; }
30+
31+
public string? Notes { get; set; }
32+
33+
public RoleEventTypeEnum Type { get; set; }
34+
35+
public DateTimeOffset Inserted { get; set; }
36+
37+
public string? AuthoriserHash { get; set; }
38+
39+
/// <summary>
40+
/// The name the role had at the time of the event.
41+
/// </summary>
42+
public string? Name { get; set; }
43+
44+
/// <summary>
45+
/// The description the role had at the time of the event.
46+
/// </summary>
47+
public string? Description { get; set; }
48+
49+
/// <summary>
50+
/// The merchant permissions the role had at the time of the event.
51+
/// </summary>
52+
public MerchantPermissions MerchantPermissions { get; set; }
53+
54+
/// <summary>
55+
/// The account permissions the role had at the time of the event.
56+
/// </summary>
57+
public AccountPermissions AccountPermissions { get; set; }
58+
59+
/// <summary>
60+
/// The client session timeout seconds the role had at the time of the event.
61+
/// </summary>
62+
public int? ClientSessionTimeoutSeconds { get; set; }
63+
64+
/// <summary>
65+
/// For <see cref="RoleEventTypeEnum.AssignedToUser"/> and <see cref="RoleEventTypeEnum.RemovedFromUser"/> event types.
66+
/// The user that was assigned to or removed from the role at the time of the event.
67+
/// </summary>
68+
public Guid? AssignationEventUserID { get; set; }
69+
70+
/// <summary>
71+
/// The number of users assigned to the role at the time of the event.
72+
/// </summary>
73+
public int? AssignedUsers { get; set; }
74+
75+
/// <summary>
76+
/// IDs of the accounts that were assigned to the role-user during the event.
77+
/// </summary>
78+
public Guid[]? AccountIDs { get; set; }
79+
80+
/// <summary>
81+
/// User that triggered the event.
82+
/// </summary>
83+
public User? User { get; set; }
84+
}

0 commit comments

Comments
 (0)