|
1 | 1 | // |
2 | | -// Copyright 2024 The Chainloop Authors. |
| 2 | +// Copyright 2024-2025 The Chainloop Authors. |
3 | 3 | // |
4 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | // you may not use this file except in compliance with the License. |
@@ -120,6 +120,7 @@ type UpsertByEmailOpts struct { |
120 | 120 | DisableAutoOnboarding *bool |
121 | 121 | FirstName *string |
122 | 122 | LastName *string |
| 123 | + SSOGroups []string |
123 | 124 | } |
124 | 125 |
|
125 | 126 | // UpsertByEmail finds or creates a user by email. By default, it will auto-onboard the user |
@@ -147,17 +148,19 @@ func (uc *UserUseCase) UpsertByEmail(ctx context.Context, email string, opts *Up |
147 | 148 | ctx = entities.WithCurrentUser(ctx, &entities.User{Email: u.Email, ID: u.ID}) |
148 | 149 | uc.auditorUC.Dispatch(ctx, &events.UserSignedUp{ |
149 | 150 | UserBase: &events.UserBase{ |
150 | | - UserID: ToPtr(uuid.MustParse(u.ID)), |
151 | | - Email: u.Email, |
| 151 | + UserID: ToPtr(uuid.MustParse(u.ID)), |
| 152 | + Email: u.Email, |
| 153 | + SSOGroups: opts.SSOGroups, |
152 | 154 | }, |
153 | 155 | }, nil) |
154 | 156 | } else { |
155 | 157 | // Login case |
156 | 158 | ctx = entities.WithCurrentUser(ctx, &entities.User{Email: u.Email, ID: u.ID}) |
157 | 159 | uc.auditorUC.Dispatch(ctx, &events.UserLoggedIn{ |
158 | 160 | UserBase: &events.UserBase{ |
159 | | - UserID: ToPtr(uuid.MustParse(u.ID)), |
160 | | - Email: u.Email, |
| 161 | + UserID: ToPtr(uuid.MustParse(u.ID)), |
| 162 | + Email: u.Email, |
| 163 | + SSOGroups: opts.SSOGroups, |
161 | 164 | }, |
162 | 165 | LoggedIn: time.Now(), |
163 | 166 | }, nil) |
|
0 commit comments