Module: Decidim::Consultations::ActionAuthorization

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/decidim/consultations/action_authorization.rb

Defined Under Namespace

Classes: AuthorizationStatus

Instance Method Summary collapse

Instance Method Details

#action_authorization(action_name, question = current_question) ⇒ Object

Public: Returns the authorization object for an authorization.

action_name - The action to authorize against.

Returns an AuthorizationStatus



19
20
21
22
23
# File 'app/controllers/concerns/decidim/consultations/action_authorization.rb', line 19

def action_authorization(action_name, question = current_question)
  return AuthorizationStatus.new(:ok) if allowed_to?(action_name.to_sym, :question, question: question)

  AuthorizationStatus.new(:denied)
end