Class: Decidim::Admin::PermissionForm

Inherits:
Form
  • Object
show all
Defined in:
decidim-admin/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


14
15
16
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 14

def authorization_handler_options(handler_name)
  find_handler(handler_name)&.dig("options") || {}
end

#authorization_handlers_namesObject


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

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

#manifest(handler_name) ⇒ Object


18
19
20
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 18

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

#options_attributes(handler_name) ⇒ Object


26
27
28
29
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 26

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

#options_schema(handler_name) ⇒ Object


22
23
24
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 22

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