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

Đang mở Phù hợp với người mới
#6,409 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
django, python
Lĩnh vực
authentication, backend

Hướng nghiên cứu

Đọc Invitation.accept trong contentcuration/contentcuration/models.py, khoảng các dòng 3701–3710, và theo dõi cách người dùng được chọn được gán vai trò. Bắt đầu bằng cách chạy hoặc tìm các bài kiểm thử chấp nhận lời mời, sau đó bổ sung kiểm thử hồi quy cho trường hợp email trùng lặp và trường hợp không có tài khoản đang hoạt động. Hoàn thành khi tài khoản đang hoạt động có email khớp chính xác được gán vai trò, và khi không có tài khoản đang hoạt động thì trả về 400 mà không thay đổi người chỉnh sửa hoặc người xem của kênh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
212
Fork
321
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của learningequality/studio

Tất cả issue của learningequality/studio

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.