Class: Decidim::Admin::PermissionForm

Inherits:
Form
  • Object
show all
Defined in:
app/forms/decidim/admin/permission_form.rb

Overview

This form handles permissions for a particular action in the admin panel.

Instance Method Summary collapse

Instance Method Details

#authorization_handler_options(handler_name) ⇒ Object



20
21
22
# File 'app/forms/decidim/admin/permission_form.rb', line 20

def authorization_handler_options(handler_name)
  authorization_handlers_options&.dig(handler_name.to_s) || {}
end

#authorization_handlersObject



10
11
12
13
14
# File 'app/forms/decidim/admin/permission_form.rb', line 10

def authorization_handlers
  handlers = super || []

  handlers.index_with { |name| { "options" => authorization_handler_options(name) } }
end

#authorization_handlers_namesObject



16
17
18
# File 'app/forms/decidim/admin/permission_form.rb', line 16

def authorization_handlers_names
  authorization_handlers.keys.map(&:to_s)
end

#manifest(handler_name) ⇒ Object



24
25
26
# File 'app/forms/decidim/admin/permission_form.rb', line 24

def manifest(handler_name)
  Decidim::Verifications.find_workflow_manifest(handler_name)
end

#options_attributes(handler_name) ⇒ Object



32
33
34
35
# File 'app/forms/decidim/admin/permission_form.rb', line 32

def options_attributes(handler_name)
  manifest = options_manifest(handler_name)
  manifest ? manifest.attributes : []
end

#options_schema(handler_name) ⇒ Object



28
29
30
# File 'app/forms/decidim/admin/permission_form.rb', line 28

def options_schema(handler_name)
  options_manifest(handler_name).schema.new(authorization_handler_options(handler_name))
end