Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/controlplane/pkg/auditor/events/apitoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ func (a *APITokenCreated) ActionInfo() (json.RawMessage, error) {

func (a *APITokenCreated) Description() string {
if a.ExpiresAt != nil {
return fmt.Sprintf("{{ .ActorEmail }} has created the API token %s expiring at %s", a.APITokenName, a.ExpiresAt.Format(time.RFC3339))
return fmt.Sprintf("%s has created the API token %s expiring at %s", auditor.GetActorIdentifier(), a.APITokenName, a.ExpiresAt.Format(time.RFC3339))
}
return fmt.Sprintf("{{ .ActorEmail }} has created the API token %s", a.APITokenName)
return fmt.Sprintf("%s has created the API token %s", auditor.GetActorIdentifier(), a.APITokenName)
}

type APITokenRevoked struct {
Expand All @@ -109,5 +109,5 @@ func (a *APITokenRevoked) ActionInfo() (json.RawMessage, error) {
}

func (a *APITokenRevoked) Description() string {
return fmt.Sprintf("{{ .ActorEmail }} has revoked the API token %s", a.APITokenName)
return fmt.Sprintf("%s has revoked the API token %s", auditor.GetActorIdentifier(), a.APITokenName)
}
2 changes: 1 addition & 1 deletion app/controlplane/pkg/auditor/events/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var updateGolden bool

const (
testEmail = "john@cyberdyne.io"
testName = "John Doe"
testName = "John Connor"
testAPITokenName = "test-token"
)

Expand Down
20 changes: 10 additions & 10 deletions app/controlplane/pkg/auditor/events/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (g *GroupCreated) ActionInfo() (json.RawMessage, error) {
}

func (g *GroupCreated) Description() string {
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has created the group %s", g.GroupName)
return fmt.Sprintf("%s has created the group %s", auditor.GetActorIdentifier(), g.GroupName)
}

// GroupUpdated represents an update to a group
Expand All @@ -113,9 +113,9 @@ func (g *GroupUpdated) ActionInfo() (json.RawMessage, error) {

func (g *GroupUpdated) Description() string {
if g.OldName != nil && g.NewName != nil {
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has renamed the group from %s to %s", *g.OldName, *g.NewName)
return fmt.Sprintf("%s has renamed the group from %s to %s", auditor.GetActorIdentifier(), *g.OldName, *g.NewName)
}
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has updated the group %s", g.GroupName)
return fmt.Sprintf("%s has updated the group %s", auditor.GetActorIdentifier(), g.GroupName)
}

// GroupDeleted represents the deletion of a group
Expand All @@ -136,7 +136,7 @@ func (g *GroupDeleted) ActionInfo() (json.RawMessage, error) {
}

func (g *GroupDeleted) Description() string {
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has deleted the group %s", g.GroupName)
return fmt.Sprintf("%s has deleted the group %s", auditor.GetActorIdentifier(), g.GroupName)
}

// GroupMemberAdded represents the addition of a member to a group
Expand Down Expand Up @@ -169,8 +169,8 @@ func (g *GroupMemberAdded) Description() string {
maintainerStatus = " as a maintainer"
}

return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has added user %s to the group %s%s",
g.UserEmail, g.GroupName, maintainerStatus)
return fmt.Sprintf("%s has added user %s to the group %s%s",
auditor.GetActorIdentifier(), g.UserEmail, g.GroupName, maintainerStatus)
}

// GroupMemberRemoved represents the removal of a member from a group
Expand All @@ -197,8 +197,8 @@ func (g *GroupMemberRemoved) ActionInfo() (json.RawMessage, error) {
}

func (g *GroupMemberRemoved) Description() string {
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has removed user %s from the group %s",
g.UserEmail, g.GroupName)
return fmt.Sprintf("%s has removed user %s from the group %s",
auditor.GetActorIdentifier(), g.UserEmail, g.GroupName)
}

// GroupMemberUpdated represents the update of a group member
Expand Down Expand Up @@ -227,6 +227,6 @@ func (g *GroupMemberUpdated) ActionInfo() (json.RawMessage, error) {
}

func (g *GroupMemberUpdated) Description() string {
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has updated user %s in the group %s",
g.UserEmail, g.GroupName)
return fmt.Sprintf("%s has updated user %s in the group %s",
auditor.GetActorIdentifier(), g.UserEmail, g.GroupName)
}
8 changes: 4 additions & 4 deletions app/controlplane/pkg/auditor/events/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (p *OrgCreated) ActionType() string {
}

func (p *OrgCreated) Description() string {
return fmt.Sprintf("{{ .ActorEmail }} has created the organization %s", p.OrgName)
return fmt.Sprintf("%s has created the organization %s", auditor.GetActorIdentifier(), p.OrgName)
}

// user joined the organization
Expand All @@ -92,7 +92,7 @@ func (p *OrgUserJoined) ActionType() string {
}

func (p *OrgUserJoined) Description() string {
return fmt.Sprintf("{{ .ActorEmail }} has joined the organization %s", p.OrgName)
return fmt.Sprintf("%s has joined the organization %s", auditor.GetActorIdentifier(), p.OrgName)
}

func (p *OrgUserJoined) ActionInfo() (json.RawMessage, error) {
Expand All @@ -113,7 +113,7 @@ func (p *OrgUserLeft) ActionType() string {
}

func (p *OrgUserLeft) Description() string {
return fmt.Sprintf("{{ .ActorEmail }} has left the organization %s", p.OrgName)
return fmt.Sprintf("%s has left the organization %s", auditor.GetActorIdentifier(), p.OrgName)
}

// user got invited to the organization
Expand All @@ -128,7 +128,7 @@ func (p *OrgUserInvited) ActionType() string {
}

func (p *OrgUserInvited) Description() string {
return fmt.Sprintf("{{ .ActorEmail }} has invited %s to the organization %s with role %s", p.ReceiverEmail, p.OrgName, p.Role)
return fmt.Sprintf("%s has invited %s to the organization %s with role %s", auditor.GetActorIdentifier(), p.ReceiverEmail, p.OrgName, p.Role)
}

func (p *OrgUserInvited) ActionInfo() (json.RawMessage, error) {
Expand Down
24 changes: 12 additions & 12 deletions app/controlplane/pkg/auditor/events/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ func (p *ProjectMemberRoleUpdated) ActionInfo() (json.RawMessage, error) {
func (p *ProjectMemberRoleUpdated) Description() string {
if p.UserID != nil {
// User role update
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has updated user '%s' role in project '%s' from '%s' to '%s'",
p.UserEmail, p.ProjectName, prettyRole(p.OldRole), prettyRole(p.NewRole))
return fmt.Sprintf("%s has updated user '%s' role in project '%s' from '%s' to '%s'",
auditor.GetActorIdentifier(), p.UserEmail, p.ProjectName, prettyRole(p.OldRole), prettyRole(p.NewRole))
}

// Group role update
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has updated group '%s' role in project '%s' from '%s' to '%s'",
p.GroupName, p.ProjectName, prettyRole(p.OldRole), prettyRole(p.NewRole))
return fmt.Sprintf("%s has updated group '%s' role in project '%s' from '%s' to '%s'",
auditor.GetActorIdentifier(), p.GroupName, p.ProjectName, prettyRole(p.OldRole), prettyRole(p.NewRole))
}

// ProjectMembershipAdded represents the addition of a member (user or group) to a project
Expand Down Expand Up @@ -156,13 +156,13 @@ func (p *ProjectMembershipAdded) Description() string {

if p.UserID != nil {
// User addition
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has added user '%s' to the project '%s'%s",
p.UserEmail, p.ProjectName, roleDesc)
return fmt.Sprintf("%s has added user '%s' to the project '%s'%s",
auditor.GetActorIdentifier(), p.UserEmail, p.ProjectName, roleDesc)
}

// Group addition
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has added group '%s' to the project '%s'%s",
p.GroupName, p.ProjectName, roleDesc)
return fmt.Sprintf("%s has added group '%s' to the project '%s'%s",
auditor.GetActorIdentifier(), p.GroupName, p.ProjectName, roleDesc)
}

// ProjectMembershipRemoved represents the removal of a member (user or group) from a project
Expand Down Expand Up @@ -196,11 +196,11 @@ func (p *ProjectMembershipRemoved) ActionInfo() (json.RawMessage, error) {
func (p *ProjectMembershipRemoved) Description() string {
if p.UserID != nil {
// User removal
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has removed user '%s' from the project '%s'",
p.UserEmail, p.ProjectName)
return fmt.Sprintf("%s has removed user '%s' from the project '%s'",
auditor.GetActorIdentifier(), p.UserEmail, p.ProjectName)
}

// Group removal
return fmt.Sprintf("{{ if .ActorEmail }}{{ .ActorEmail }}{{ else }}system@chainloop.dev{{ end }} has removed group '%s' from the project '%s'",
p.GroupName, p.ProjectName)
return fmt.Sprintf("%s has removed group '%s' from the project '%s'",
auditor.GetActorIdentifier(), p.GroupName, p.ProjectName)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has created the API token test-token",
"Description": "John Connor has created the API token test-token",
"Info": {
"api_token_id": "2089bb36-e27b-428b-8009-d015c8737c55",
"api_token_name": "test-token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has created the API token test-token",
"Description": "John Connor has created the API token test-token",
"Info": {
"api_token_id": "2089bb36-e27b-428b-8009-d015c8737c55",
"api_token_name": "test-token",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has created the API token test-token expiring at 2025-01-01T00:00:00Z",
"Description": "John Connor has created the API token test-token expiring at 2025-01-01T00:00:00Z",
"Info": {
"api_token_id": "2089bb36-e27b-428b-8009-d015c8737c55",
"api_token_name": "test-token",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"ActorEmail": "",
"ActorName": "test-token",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": " has revoked the API token test-token",
"Description": "test-token has revoked the API token test-token",
"Info": {
"api_token_id": "2089bb36-e27b-428b-8009-d015c8737c55",
"api_token_name": "test-token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has created the group test-group",
"Description": "John Connor has created the group test-group",
"Info": {
"group_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"group_name": "test-group",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has deleted the group test-group",
"Description": "John Connor has deleted the group test-group",
"Info": {
"group_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"group_name": "test-group"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has added user test@example.com to the group test-group as a maintainer",
"Description": "John Connor has added user test@example.com to the group test-group as a maintainer",
"Info": {
"group_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"group_name": "test-group",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has removed user test@example.com from the group test-group",
"Description": "John Connor has removed user test@example.com from the group test-group",
"Info": {
"group_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"group_name": "test-group",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has updated user test@example.com in the group test-group",
"Description": "John Connor has updated user test@example.com in the group test-group",
"Info": {
"group_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"group_name": "test-group",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has updated the group test-group",
"Description": "John Connor has updated the group test-group",
"Info": {
"group_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"group_name": "test-group",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has updated the group test-group",
"Description": "John Connor has updated the group test-group",
"Info": {
"group_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"group_name": "test-group",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has added user 'test@example.com' to the project 'test-project' with role 'viewer'",
"Description": "John Connor has added user 'test@example.com' to the project 'test-project' with role 'viewer'",
"Info": {
"project_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"project_name": "test-project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has added user 'test@example.com' to the project 'test-project' with role 'admin'",
"Description": "John Connor has added user 'test@example.com' to the project 'test-project' with role 'admin'",
"Info": {
"project_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"project_name": "test-project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"ActorEmail": "",
"ActorName": "test-token",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "system@chainloop.dev has added user 'test@example.com' to the project 'test-project' with role 'viewer'",
"Description": "test-token has added user 'test@example.com' to the project 'test-project' with role 'viewer'",
"Info": {
"project_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"project_name": "test-project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has removed user 'test@example.com' from the project 'test-project'",
"Description": "John Connor has removed user 'test@example.com' from the project 'test-project'",
"Info": {
"project_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"project_name": "test-project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"ActorEmail": "",
"ActorName": "test-token",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "system@chainloop.dev has removed user 'test@example.com' from the project 'test-project'",
"Description": "test-token has removed user 'test@example.com' from the project 'test-project'",
"Info": {
"project_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"project_name": "test-project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has updated user 'test@example.com' role in project 'test-project' from 'viewer' to 'admin'",
"Description": "John Connor has updated user 'test@example.com' role in project 'test-project' from 'viewer' to 'admin'",
"Info": {
"project_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"project_name": "test-project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"ActorEmail": "",
"ActorName": "test-token",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "system@chainloop.dev has updated user 'test@example.com' role in project 'test-project' from 'viewer' to 'admin'",
"Description": "test-token has updated user 'test@example.com' role in project 'test-project' from 'viewer' to 'admin'",
"Info": {
"project_id": "3089bb36-e27b-428b-8009-d015c8737c56",
"project_name": "test-project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"ActorType": "USER",
"ActorID": "1089bb36-e27b-428b-8009-d015c8737c54",
"ActorEmail": "john@cyberdyne.io",
"ActorName": "John Doe",
"ActorName": "John Connor",
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
"Description": "john@cyberdyne.io has logged in",
"Info": {
Expand Down
Loading
Loading