MCPcopy Create free account
hub / github.com/supabase/auth / adminUserDeleteFactor

Method adminUserDeleteFactor

internal/api/admin.go:578–601  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

576}
577
578func (a *API) adminUserDeleteFactor(w http.ResponseWriter, r *http.Request) error {
579 ctx := r.Context()
580 config := a.config
581 user := getUser(ctx)
582 factor := getFactor(ctx)
583 db := a.db.WithContext(ctx)
584
585 err := db.Transaction(func(tx *storage.Connection) error {
586 if terr := models.NewAuditLogEntry(config.AuditLog, r, tx, user, models.DeleteFactorAction, utilities.GetIPAddress(r), map[string]interface{}{
587 "user_id": user.ID,
588 "factor_id": factor.ID,
589 }); terr != nil {
590 return terr
591 }
592 if terr := tx.Destroy(factor); terr != nil {
593 return apierrors.NewInternalServerError("Database error deleting factor").WithInternalError(terr)
594 }
595 return nil
596 })
597 if err != nil {
598 return err
599 }
600 return sendJSON(w, http.StatusOK, factor)
601}
602
603func (a *API) adminUserGetFactors(w http.ResponseWriter, r *http.Request) error {
604 ctx := r.Context()

Callers

nothing calls this directly

Calls 9

NewAuditLogEntryFunction · 0.92
GetIPAddressFunction · 0.92
NewInternalServerErrorFunction · 0.92
getUserFunction · 0.85
getFactorFunction · 0.85
sendJSONFunction · 0.85
WithContextMethod · 0.80
TransactionMethod · 0.80
WithInternalErrorMethod · 0.45

Tested by

no test coverage detected