Skip to content

Commit

Permalink
Fix the mammal incidents permission view
Browse files Browse the repository at this point in the history
  • Loading branch information
RickWangPerth committed Oct 24, 2024
1 parent 72ebf59 commit 83e9c48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ <h1 class="incident-title">Marine Mammal Incidents</h1>
<th>Species</th>
<th>Location</th>
<th>Type</th>
{% if request.user|mmi_has_group:"data curator" or request.user.is_superuser or request.user|mmi_has_group:"MARINE_ANIMAL_INCIDENTS"%}
<th>Actions</th>
{% endif %}
</tr>
</thead>
<tbody>
Expand All @@ -156,9 +158,11 @@ <h1 class="incident-title">Marine Mammal Incidents</h1>
<td>{{ incident.species }}</td>
<td>{{ incident.location_name }}</td>
<td>{{ incident.get_incident_type_display }}</td>
{% if request.user|mmi_has_group:"data curator" or request.user.is_superuser or request.user|mmi_has_group:"MARINE_ANIMAL_INCIDENTS"%}
<td>
<a href="{% url 'marine_mammal_incidents:update_incident' incident.id %}" class="btn btn-sm btn-primary">View / Update</a>
</td>
{% endif %}
</tr>
{% empty %}
<tr><td colspan="5">No incidents recorded yet.</td></tr>
Expand Down
2 changes: 1 addition & 1 deletion marine_mammal_incidents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from django.core.exceptions import PermissionDenied

def user_in_marine_animal_incidents_group(user):
return user.is_superuser or user.groups.filter(name='MARINE_ANIMAL_INCIDENTS').exists()
return user.is_superuser or user.groups.filter(name='MARINE_ANIMAL_INCIDENTS') or user.groups.filter(name='data curator').exists()

@user_passes_test(user_in_marine_animal_incidents_group, login_url=None, redirect_field_name=None)
def incident_form(request, pk=None):
Expand Down

0 comments on commit 83e9c48

Please sign in to comment.