Add competition creation allowlist via COMPETITION_CREATOR_GROUP#2215
Add competition creation allowlist via COMPETITION_CREATOR_GROUP#2215cjh1 wants to merge 1 commit intocodalab:developfrom
Conversation
|
This should not be a Instead, we could for example:
@IdirLISN what do you think? |
|
@Didayolo I agree, that would be a better implementation, the reason I chose the approach I did is I wanted to avoid changing the schema. If changing the schema is acceptable, I can go ahead and update the implementation. |
Updating the schema is fine, especially if it is for a better implementation. Maybe Idir can give an opinion about the proposed implementation, but if you think it is good you can go ahead implement it. |
|
Hello, Updating the user model is doable but not necessary as we can just verify if the user is admin (super user) or staff member (user who have access to admin page but with less rights than admin). When someone create a competition, this endpoint is called: api/competitions/9/creation_status/ we will just need to add a new model to define a boolean like @Didayolo said to configure what kind of behaviour we want. |
This PR adds a configurable allowlist for competition creation using
COMPETITION_CREATOR_GROUP.Changes
src/settings/base.py.COMPETITION_CREATOR_GROUP(loaded from env, default empty).src/apps/api/permissions.pysrc/apps/api/views/competitions.py:createnow requiresIsCompetitionCreator(instead of any authenticated user).src/apps/api/views/datasets.py:src/utils/context_processors.py..env_sample.Behavior
COMPETITION_CREATOR_GROUPis empty: authenticated users can create competitions.Checklist