Skip to content

Add competition creation allowlist via COMPETITION_CREATOR_GROUP#2215

Open
cjh1 wants to merge 1 commit intocodalab:developfrom
cjh1:competition-create-whitelist
Open

Add competition creation allowlist via COMPETITION_CREATOR_GROUP#2215
cjh1 wants to merge 1 commit intocodalab:developfrom
cjh1:competition-create-whitelist

Conversation

@cjh1
Copy link
Contributor

@cjh1 cjh1 commented Feb 25, 2026

This PR adds a configurable allowlist for competition creation using COMPETITION_CREATOR_GROUP.

Changes

  • Added new setting in src/settings/base.py.
    • COMPETITION_CREATOR_GROUP (loaded from env, default empty).
  • Added permission helpers and class in src/apps/api/permissions.py
  • Updated competition create API permission in src/apps/api/views/competitions.py:
    • create now requires IsCompetitionCreator (instead of any authenticated user).
  • Added enforcement in competition bundle completion flow in src/apps/api/views/datasets.py:
    • deny if configured creator group is missing.
    • deny if user is not allowed to create competitions.
  • Exposed frontend capability flag in src/utils/context_processors.py.
  • Updated UI buttons visibility.
  • Documented env var in .env_sample.

Behavior

  • If COMPETITION_CREATOR_GROUP is empty: authenticated users can create competitions.
  • If set and group exists: only group members (and superusers) can create.
  • If set but group does not exist: competition creation is disabled with explicit error messages.

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant