Accepting an invitation gives the role to a user record looked up by email

Offen Anfängerfreundlich
#6,409 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
76/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
django, python

Rechercherichtung

Lies Invitation.accept in contentcuration/contentcuration/models.py im Bereich der Zeilen 3701–3710 und verfolge, wie dem ausgewählten Benutzer die Rolle zugewiesen wird. Führe zunächst die Tests zur Annahme von Einladungen aus oder finde sie, und ergänze dann Regressionstests für die Fälle mit doppelter E-Mail-Adresse und ohne aktives Konto. Als abgeschlossen gilt die Arbeit, wenn das aktive Konto mit der exakt übereinstimmenden E-Mail-Adresse die Rolle erhält und ein fehlendes aktives Konto den Status 400 zurückgibt, ohne die Kanal-Editoren oder -Betrachter zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

DEV: backend

Overview

Invitation.accept looks the invited user up again by email, case-insensitively, with no filter on active or deleted users and no ordering. When several user records share the email in different case, the role can go to an inactive or deleted record instead of the user who accepted. When an admin accepts an invitation for an email that has no account, accept adds None as an editor and the request fails with IntegrityError.

Complexity: Low
Target branch: hotfixes

Context
  • Invitation.accept starts with User.objects.filter(email__iexact=self.email).first().
  • Reproduced:
    • Active user [email protected] accepts an invitation. An older inactive record [email protected] becomes the channel editor, and the accepting user doesn't.
    • An admin accepts an invitation for an email with no account, and gets 500 with IntegrityError on a null user_id.
  • Related: #4779, #3050. #6406 backports the invitee-only accept check to hotfixes. #6405 depends on the same lookup on unstable.
The Change
  • Accepting should give the role to the active account whose email exactly matches the invitation's. #5893 lets admins accept on an invitee's behalf, so the accepting user isn't always the invitee.
  • Accepting an invitation with no matching active account should fail with a validation error and change nothing.
Acceptance Criteria
General
  • When other records share the invitee's email in a different case, the active account with the exact email gets the role and no other record does.
  • Accepting an invitation whose email has no active account returns 400 and leaves the channel's editors and viewers unchanged.
Testing
  • Both reproduced cases in Context have regression tests.

AI usage

I scoped the audit. Claude Code found and reproduced these failures and drafted this issue.

Vorherrschende Sprache
Python
Sterne
212
Forks
321
Ø Merge
1 T. 7 Std.
Gemergte PRs (30 T.)
14

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus learningequality/studio

Alle Issues in learningequality/studio

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.