Skip to content

Commit

Permalink
Merge pull request #2024 from lstout/lstout/audit_events_event_names
Browse files Browse the repository at this point in the history
Add event_name field to the audit events.
  • Loading branch information
svanharmelen authored Oct 8, 2024
2 parents 3047899 + 746285e commit 49a7d19
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions audit_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type AuditEvent struct {
AuthorID int `json:"author_id"`
EntityID int `json:"entity_id"`
EntityType string `json:"entity_type"`
EventName string `json:"event_name"`
Details AuditEventDetails `json:"details"`
CreatedAt *time.Time `json:"created_at"`
EventType string `json:"event_type"`
Expand Down Expand Up @@ -42,6 +43,7 @@ type AuditEventDetails struct {
IPAddress string `json:"ip_address"`
EntityPath string `json:"entity_path"`
FailedLogin string `json:"failed_login"`
EventName string `json:"event_name"`
}

// AuditEventsService handles communication with the project/group/instance
Expand Down
24 changes: 24 additions & 0 deletions audit_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ func TestAuditEventsService_ListInstanceAuditEvents(t *testing.T) {
"author_id": 1,
"entity_id": 6,
"entity_type": "Project",
"event_name": "project_archived",
"details": {
"event_name": "project_archived",
"custom_message": "Project archived",
"author_name": "Venkatesh Thalluri",
"target_id": "flightjs/flight",
Expand All @@ -39,7 +41,9 @@ func TestAuditEventsService_ListInstanceAuditEvents(t *testing.T) {
AuthorID: 1,
EntityID: 6,
EntityType: "Project",
EventName: "project_archived",
Details: AuditEventDetails{
EventName: "project_archived",
CustomMessage: "Project archived",
AuthorName: "Venkatesh Thalluri",
TargetID: "flightjs/flight",
Expand Down Expand Up @@ -86,7 +90,9 @@ func TestAuditEventsService_GetInstanceAuditEvent(t *testing.T) {
"author_id": 1,
"entity_id": 6,
"entity_type": "Project",
"event_name": "project_archived",
"details": {
"event_name": "project_archived",
"custom_message": "Project archived",
"author_name": "Venkatesh Thalluri",
"target_id": "flightjs/flight",
Expand All @@ -103,8 +109,10 @@ func TestAuditEventsService_GetInstanceAuditEvent(t *testing.T) {
ID: 1,
AuthorID: 1,
EntityID: 6,
EventName: "project_archived",
EntityType: "Project",
Details: AuditEventDetails{
EventName: "project_archived",
CustomMessage: "Project archived",
AuthorName: "Venkatesh Thalluri",
TargetID: "flightjs/flight",
Expand Down Expand Up @@ -143,7 +151,9 @@ func TestAuditEventsService_ListGroupAuditEvents(t *testing.T) {
"author_id": 1,
"entity_id": 6,
"entity_type": "Group",
"event_name": "group_archived",
"details": {
"event_name": "group_archived",
"custom_message": "Group archived",
"author_name": "Venkatesh Thalluri",
"target_id": "flightjs/flight",
Expand All @@ -162,7 +172,9 @@ func TestAuditEventsService_ListGroupAuditEvents(t *testing.T) {
AuthorID: 1,
EntityID: 6,
EntityType: "Group",
EventName: "group_archived",
Details: AuditEventDetails{
EventName: "group_archived",
CustomMessage: "Group archived",
AuthorName: "Venkatesh Thalluri",
TargetID: "flightjs/flight",
Expand Down Expand Up @@ -205,7 +217,9 @@ func TestAuditEventsService_GetGroupAuditEvent(t *testing.T) {
"author_id": 1,
"entity_id": 6,
"entity_type": "Group",
"event_name": "group_archived",
"details": {
"event_name": "group_archived",
"custom_message": "Group archived",
"author_name": "Venkatesh Thalluri",
"target_id": "flightjs/flight",
Expand All @@ -223,7 +237,9 @@ func TestAuditEventsService_GetGroupAuditEvent(t *testing.T) {
AuthorID: 1,
EntityID: 6,
EntityType: "Group",
EventName: "group_archived",
Details: AuditEventDetails{
EventName: "group_archived",
CustomMessage: "Group archived",
AuthorName: "Venkatesh Thalluri",
TargetID: "flightjs/flight",
Expand Down Expand Up @@ -267,7 +283,9 @@ func TestAuditEventsService_ListProjectAuditEvents(t *testing.T) {
"author_id": 1,
"entity_id": 6,
"entity_type": "Project",
"event_name": "project_archived",
"details": {
"event_name": "project_archived",
"custom_message": "Project archived",
"author_name": "Venkatesh Thalluri",
"target_id": "flightjs/flight",
Expand All @@ -286,7 +304,9 @@ func TestAuditEventsService_ListProjectAuditEvents(t *testing.T) {
AuthorID: 1,
EntityID: 6,
EntityType: "Project",
EventName: "project_archived",
Details: AuditEventDetails{
EventName: "project_archived",
CustomMessage: "Project archived",
AuthorName: "Venkatesh Thalluri",
TargetID: "flightjs/flight",
Expand Down Expand Up @@ -329,7 +349,9 @@ func TestAuditEventsService_GetProjectAuditEvent(t *testing.T) {
"author_id": 1,
"entity_id": 6,
"entity_type": "Project",
"event_name": "project_archived",
"details": {
"event_name": "project_archived",
"custom_message": "Project archived",
"author_name": "Venkatesh Thalluri",
"target_id": "flightjs/flight",
Expand All @@ -347,7 +369,9 @@ func TestAuditEventsService_GetProjectAuditEvent(t *testing.T) {
AuthorID: 1,
EntityID: 6,
EntityType: "Project",
EventName: "project_archived",
Details: AuditEventDetails{
EventName: "project_archived",
CustomMessage: "Project archived",
AuthorName: "Venkatesh Thalluri",
TargetID: "flightjs/flight",
Expand Down

0 comments on commit 49a7d19

Please sign in to comment.