Sha256: 03e8d815b68d809599a744c6ff8fb63168c938b0f08676a871dab3f5b455768d
Contents?: true
Size: 820 Bytes
Versions: 4
Compression:
Stored size: 820 Bytes
Contents
# frozen_string_literal: true module Decidim module ActionDelegator module ConsultationsPermissionsExtension # Overrides Decidim::Consultations::Permissions to account for delegation votes def allowed_public_action? return unless permission_action.scope == :public return unless permission_action.subject == :question # check if question has been limited by admins first return unless authorized? :vote case permission_action.action when :vote toggle_allow(question.can_be_voted_by?(user) || can_be_delegated?(user)) when :unvote toggle_allow(question.can_be_unvoted_by?(user)) end end def can_be_delegated?(user) Delegation.granted_to?(user, question.consultation) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems