Skip to content

Commit

Permalink
fix(users): check before send update request if user is protected
Browse files Browse the repository at this point in the history
  • Loading branch information
curzolapierre committed Feb 23, 2024
1 parent b4edee7 commit 0514162
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions db/users/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ func UpdateUser(ctx context.Context, app, addonUUID, username string) error {
if !userExists {
return errors.New(ctx, fmt.Sprintf("User \"%s\" does not exist", username))
}
// Check if the user is protected
var userIsProtected bool
for _, user := range l {
if user.Protected {
userIsProtected = true
break
}
}
if userIsProtected {
return errors.New(ctx, fmt.Sprintf("User \"%s\" is protected and cannot be updated", username))
}

password, confirmedPassword, err := askForPasswordWithRetry(ctx, 3)
if err != nil {
Expand Down

0 comments on commit 0514162

Please sign in to comment.