Organization admins can add any user as a member without their agreement

Offen
#6,405 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
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python

Rechercherichtung

Start with contentcuration/viewsets/organization.py, especially OrganizationMemberSerializer and perform_create, then read contentcuration/viewsets/organization_migration.py around is_uncontested. Trace the invitation acceptance path and the regression tests for the two reproduced cases. Done means direct membership creation for another user is rejected, invitation acceptance preserves the invited role, and unaccepted editors require migration approval.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

DEV: backend

Overview

POST /api/organization-members/ lets an organization admin add any user to the organization, with any role and status, without that user agreeing. Anyone can create an organization and become its admin, so any logged-in user can do this. The response returns the added user's email and name, and a channel editor added this way counts as agreeing to move their channel into the organization.

Complexity: Medium
Target branch: unstable

Context
  • OrganizationMemberSerializer limits organization to the requester's organizations, but user is a plain primary key field over all users. perform_create saves it as given.
  • The member viewset returns user_email, user_first_name and user_last_name.
  • Accepting an organization invitation finds the user with the same case-insensitive email lookup that #6409 fixes on hotfixes.
  • is_uncontested treats a channel migration as needing no administrator approval when every channel editor is an active admin or editor of the target organization.
  • Reproduced:
    • A user creates an organization, then sends {"organization": <their org>, "user": <any user id>, "status": "inactive"}. The response is 201 with that user's email and name. User ids are sequential integers.
    • Channel co-editor A creates an organization and adds co-editor B as an active editor. A's POST /api/channel/<id>/organization_migration/ then moves the channel without administrator approval, and A gains organization admin rights over it.
The Change
  • A user should join an organization only by accepting an organization invitation. Admins should not be able to create memberships for other users directly.
  • is_uncontested should count only memberships the user accepted.
Acceptance Criteria
General
  • POST /api/organization-members/ for a user other than the requester returns 4xx and creates no membership.
  • Accepting an organization invitation creates the membership with the invited role.
  • Migrating a channel into an organization that one of its editors hasn't joined by accepting an invitation requires administrator approval.
Testing
  • Regression tests cover both reproduced cases in Context.

AI usage

I scoped the audit and decided these findings get an unstable issue. Claude Code found and reproduced them 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.