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

Ouverte
#6,405 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Python
Étoiles
212
Forks
321
Merge moyen
1 j 7 h
PR mergées (30 j)
14

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de learningequality/studio

Toutes les issues de learningequality/studio

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.