Skip to content

Creating a Django group to limit who can create competitions #1961

@the1mag

Description

@the1mag

Hi,
I am trying to create a django group with permissions to create competitions so that users would need to be added to this group by administrators before they can create competitions. I want regular authenticated users to not have the permission to create competitions. I have tried implementing this by creating a new permission class IsCompetitionCreator similar to the existing IsOrganizationEditor permission in src/apps/api/permissions.py. Then I changed this file src/apps/api/views/competitions.py to use: if self.action in ['create']: self.permission_classes = [IsCompetitionCreator], instead of using [IsAuthenticated]. I made sure to restart django and run the migration, however, when I test by creating a new user, I see that they still have permissions to create competitions. I also see on the django site administration, that every user shows the Competition Creator group, but I checked that the group was actually empty. Is there a better way I can go about creating this group, or do you guys have any idea why this method is not working?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionNeeds to be discussed before we can come up with specifications and begin the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions