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