Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

[fix bug 1308910] Fix voting permissions. #1267

Merged
merged 1 commit into from
Oct 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions remo/voting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ def view_voting(request, slug):
poll = get_object_or_404(Poll, slug=slug)

is_council = request.user.groups.filter(name='Council').exists()
is_peer = request.user.groups.filter(name='Peers').exists()
is_peer = user.groups.filter(name='Peers').exists()
is_review_poll = poll.valid_groups.name == 'Review'
read_only_perms = is_peer or (is_council and is_review_poll)
user_should_vote = user.groups.filter(id=poll.valid_groups.id).exists()
read_only_perms = (is_peer or (is_council and is_review_poll)) and not user_should_vote

# If the user does not belong to a valid poll group
if not user_has_poll_permissions(user, poll) and not read_only_perms:
Expand Down