Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00

remove federated user in case of user deletion

This commit is contained in:
Michael Jerger 2024-04-02 18:36:22 +02:00
parent 5edf7d0e61
commit 7a142c876e
2 changed files with 12 additions and 0 deletions

View file

@ -76,3 +76,8 @@ func FindFederatedUser(ctx context.Context, externalID string,
}
return user, federatedUser, nil
}
func DeleteFederatedUser(ctx context.Context, userID int64) error {
_, err := db.GetEngine(ctx).Delete(&FederatedUser{UserID: userID})
return err
}

View file

@ -208,6 +208,13 @@ func DeleteUser(ctx context.Context, u *user_model.User, purge bool) error {
return err
}
}
// Delete Federated Users
if setting.Federation.Enabled {
if err := user_model.DeleteFederatedUser(ctx, u.ID); err != nil {
return err
}
}
}
ctx, committer, err := db.TxContext(ctx)