Skip to content

Commit

Permalink
fix disposition permission check
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrindt committed Nov 27, 2024
1 parent ad6c523 commit 9b98c0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ephios/core/templatetags/event_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ def event_plugin_actions(event_detail_view):
@register.filter
def can_do_disposition_for(user: UserProfile, shift):
return (
user.has_perm("core:change_event", shift.event)
user.has_perm("change_event", shift.event)
and shift.structure.disposition_participation_form_class is not None
)
17 changes: 17 additions & 0 deletions tests/core/test_event_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,20 @@ def test_event_slug_with_empty_name(django_app, volunteer, event):
assert response.location # is a redirect
response = response.follow()
assert event.description in response


def test_show_disposition_button(django_app, volunteer, planner, event):
assert (
"Disposition"
not in django_app.get(
reverse("core:event_detail", kwargs=dict(pk=event.pk, slug="nottheactualslug")),
user=volunteer,
).follow()
)
assert (
"Disposition"
in django_app.get(
reverse("core:event_detail", kwargs=dict(pk=event.pk, slug="nottheactualslug")),
user=planner,
).follow()
)

0 comments on commit 9b98c0a

Please sign in to comment.