Class: Decidim::ActionDelegator::Verifications::DelegationsAuthorizer

Inherits:
Verifications::DefaultActionAuthorizer
  • Object
show all
Defined in:
lib/decidim/action_delegator/verifications/delegations_authorizer.rb

Instance Method Summary collapse

Instance Method Details

#authorizeObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/decidim/action_delegator/verifications/delegations_authorizer.rb', line 7

def authorize
  status = super
  return status unless status == [:ok, {}]

  # if used outside a consultation, allow all
  return [:ok, {}] if consultation.blank?
  return [:ok, {}] if belongs_to_consultation? && user_in_census?

  [:unauthorized, { extra_explanation: extra_explanations }]
end