checks for verified users when creating and voting proposals

This commit is contained in:
rgarcia
2015-10-08 15:37:59 +02:00
parent e49bea806b
commit c21a78e164
2 changed files with 84 additions and 41 deletions

View File

@@ -4,6 +4,8 @@ class Management::ProposalsController < Management::BaseController
include HasOrders
include CommentableActions
before_action :check_verified_user, except: :print
before_action :set_proposal, only: :vote
before_action :parse_search_terms, only: :index
@@ -39,6 +41,12 @@ class Management::ProposalsController < Management::BaseController
Proposal
end
def check_verified_user
unless current_user.level_two_or_three_verified?
redirect_to management_root_path, alert: 'User is not verified'
end
end
#Duplicated in application_controller. Move to a concenrn.
def set_proposal_votes(proposals)
@proposal_votes = current_user ? current_user.proposal_votes(proposals) : {}