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
17
18
19
# File 'lib/decidim/action_delegator/verifications/delegations_authorizer.rb', line 7

def authorize
  if !authorization
    [:missing, { action: :authorize }]
  elsif authorization_expired?
    [:expired, { action: :authorize }]
  elsif !authorization.granted?
    [:pending, { action: :resume }]
  elsif invalid_setting?
    return [:unauthorized, { extra_explanation: extra_explanations }]
  else
    [:ok, {}]
  end
end

#invalid_setting?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
# File 'lib/decidim/action_delegator/verifications/delegations_authorizer.rb', line 21

def invalid_setting?
  return true unless setting
  return true unless user_is_a_participant?

  false
end