Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make NewSession behave same way like UpdateSession method #594

Merged
merged 12 commits into from
Dec 9, 2024
10 changes: 7 additions & 3 deletions go/controller/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,13 @@ func (wf *Workflows) NewSession(
if err != nil {
return nil, fmt.Errorf("error getting roles by user id: %w", err)
}
allowedRoles := make([]string, len(userRoles))
for i, role := range userRoles {
allowedRoles[i] = role.Role
allowedRoles := make([]string, 0, len(userRoles))
for _, role := range userRoles {
allowedRoles = append(allowedRoles, role.Role)
}

if !slices.Contains(allowedRoles, user.DefaultRole) {
allowedRoles = append(allowedRoles, user.DefaultRole)
}

refreshToken := uuid.New()
Expand Down