Skip to content

Commit 5c10eaf

Browse files
authored
fix(events): user auth names (#2330)
Signed-off-by: Miguel Martinez <[email protected]>
1 parent 277331d commit 5c10eaf

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

app/controlplane/pkg/auditor/events/testdata/users/user_logs_in.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"ActorEmail": "[email protected]",
88
"ActorName": "John Connor",
99
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
10-
"Description": "[email protected] has logged in",
10+
"Description": "John Connor has logged in",
1111
"Info": {
1212
"user_id": "1089bb36-e27b-428b-8009-d015c8737c54",
1313
"email": "[email protected]",

app/controlplane/pkg/auditor/events/testdata/users/user_signs_up.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"ActorEmail": "[email protected]",
88
"ActorName": "John Connor",
99
"OrgID": "1089bb36-e27b-428b-8009-d015c8737c54",
10-
"Description": "[email protected] has signed up",
10+
"Description": "John Connor has signed up",
1111
"Info": {
1212
"user_id": "1089bb36-e27b-428b-8009-d015c8737c54",
1313
"email": "[email protected]"

app/controlplane/pkg/auditor/events/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (p *UserSignedUp) ActionType() string {
7373
}
7474

7575
func (p *UserSignedUp) Description() string {
76-
return fmt.Sprintf("%s has signed up", p.Email)
76+
return fmt.Sprintf("%s has signed up", auditor.GetActorIdentifier())
7777
}
7878

7979
type UserLoggedIn struct {
@@ -87,7 +87,7 @@ func (p *UserLoggedIn) ActionType() string {
8787
}
8888

8989
func (p *UserLoggedIn) Description() string {
90-
return fmt.Sprintf("%s has logged in", p.Email)
90+
return fmt.Sprintf("%s has logged in", auditor.GetActorIdentifier())
9191
}
9292

9393
func (p *UserLoggedIn) ActionInfo() (json.RawMessage, error) {

app/controlplane/pkg/biz/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (uc *UserUseCase) UpsertByEmail(ctx context.Context, email string, opts *Up
145145
}
146146

147147
// set the context user so it can be used in the auditor
148-
ctx = entities.WithCurrentUser(ctx, &entities.User{Email: u.Email, ID: u.ID})
148+
ctx = entities.WithCurrentUser(ctx, &entities.User{Email: u.Email, ID: u.ID, FirstName: u.FirstName, LastName: u.LastName})
149149
uc.auditorUC.Dispatch(ctx, &events.UserSignedUp{
150150
UserBase: &events.UserBase{
151151
UserID: ToPtr(uuid.MustParse(u.ID)),
@@ -155,7 +155,7 @@ func (uc *UserUseCase) UpsertByEmail(ctx context.Context, email string, opts *Up
155155
}, nil)
156156
} else {
157157
// Login case
158-
ctx = entities.WithCurrentUser(ctx, &entities.User{Email: u.Email, ID: u.ID})
158+
ctx = entities.WithCurrentUser(ctx, &entities.User{Email: u.Email, ID: u.ID, FirstName: u.FirstName, LastName: u.LastName})
159159
uc.auditorUC.Dispatch(ctx, &events.UserLoggedIn{
160160
UserBase: &events.UserBase{
161161
UserID: ToPtr(uuid.MustParse(u.ID)),

0 commit comments

Comments
 (0)