mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
Little permission fix
This commit is contained in:
parent
e17fd22a37
commit
5449a4fca2
@ -362,7 +362,9 @@ th {
|
||||
{%- endif %}
|
||||
<a href="{{url('election:create_list', election_id=object.id)}}">{% trans %}Add a new list{% endtrans %}</a>
|
||||
{%- if user.can_edit(election) %}
|
||||
{% if election.is_vote_editable %}
|
||||
<a href="{{url('election:create_role', election_id=object.id)}}">{% trans %}Add a new role{% endtrans %}</a>
|
||||
{% endif %}
|
||||
<a href="{{url('election:update', election_id=object.id)}}">{% trans %}Edit{% endtrans %}</a>
|
||||
{%- endif %}
|
||||
</section>
|
||||
|
@ -289,7 +289,7 @@ class RoleCreateView(CanCreateMixin, CreateView):
|
||||
|
||||
def dispatch(self, request, *arg, **kwargs):
|
||||
self.election = get_object_or_404(Election, pk=kwargs['election_id'])
|
||||
if self.election.is_vote_editable:
|
||||
if not self.election.is_vote_editable:
|
||||
raise PermissionDenied
|
||||
return super(RoleCreateView, self).dispatch(request, *arg, **kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user