Skip to content

Commit

Permalink
removed write permission on Event for jubkom (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsNyl committed Jan 11, 2024
1 parent b408c66 commit 603abeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/content/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.core.exceptions import ValidationError
from django.db import models

from app.common.enums import AdminGroup, Groups
from app.common.enums import AdminGroup
from app.common.permissions import (
BasePermissionModel,
check_has_access,
Expand All @@ -21,7 +21,7 @@

class Event(BaseModel, OptionalImage, BasePermissionModel):

write_access = (*AdminGroup.admin(), AdminGroup.PROMO, Groups.JUBKOM)
write_access = (*AdminGroup.admin(), AdminGroup.PROMO)

title = models.CharField(max_length=200)
start_date = models.DateTimeField()
Expand Down
8 changes: 6 additions & 2 deletions app/tests/content/test_event_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,13 +861,17 @@ def test_expired_filter_list(api_client, admin_user, expired, expected_count):


@pytest.mark.django_db
def test_jubkom_has_create_permission(api_client, jubkom_member):
def test_jubkom_has_not_create_permission(api_client, jubkom_member):
"""
A jubkom member should not be able to create an event.
"""

client = api_client(user=jubkom_member)
organizer = Group.objects.get(name=Groups.JUBKOM).slug
data = get_event_data(organizer=organizer)
response = client.post(API_EVENTS_BASE_URL, data)

assert response.status_code == status.HTTP_201_CREATED
assert response.status_code == status.HTTP_403_FORBIDDEN


@pytest.mark.django_db
Expand Down

0 comments on commit 603abeb

Please sign in to comment.