Some permissions fixs and security for atomic vote

This commit is contained in:
2016-12-26 23:30:13 +01:00
parent 729659e358
commit 2f2d5292de
4 changed files with 34 additions and 16 deletions

View File

@ -5,7 +5,7 @@
{% endblock %}
{% block content %}
{%- if election.can_candidate(user) or user.can_edit(election) %}
{%- if (election.can_candidate(user) and election.is_candidature_active) or (user.can_edit(election) and election.is_vote_editable) %}
<section class="election__add-candidature">
<form action="{{ url('election:candidate', election_id=election.id) }}" method="post">
{% csrf_token %}

View File

@ -359,7 +359,7 @@ th {
</section>
{%- endif %}
<section class="election__add-elements">
{%- if election.can_candidate(user) or user.can_edit(election) %}
{%- if (election.can_candidate(user) and election.is_candidature_active) or (user.can_edit(election) and election.is_vote_editable) %}
<a href="{{ url('election:candidate', election_id=object.id) }}">{% trans %}Candidate{% endtrans %}</a>
{%- endif %}
<a href="{{ url('election:create_list', election_id=object.id) }}">{% trans %}Add a new list{% endtrans %}</a>