Class: Decidim::Admin::Components::BaseController

Inherits:
ApplicationController show all
Includes:
ParticipatorySpaceAdminContext, NeedsPermission, Settings
Defined in:
decidim-admin/app/controllers/decidim/admin/components/base_controller.rb

Overview

This controller is the abstract class from which all component controllers in their admin engines should inherit from.

Instance Method Summary collapse

Methods included from RegistersPermissions

register_permissions

Methods inherited from ApplicationController

#user_has_no_permission_path, #user_not_authorized_path

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from NeedsSnippets

#snippets

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#current_componentObject


52
53
54
# File 'decidim-admin/app/controllers/decidim/admin/components/base_controller.rb', line 52

def current_component
  request.env["decidim.current_component"]
end

#current_participatory_spaceObject


56
57
58
# File 'decidim-admin/app/controllers/decidim/admin/components/base_controller.rb', line 56

def current_participatory_space
  current_component.participatory_space
end

#parent_pathObject


60
61
62
# File 'decidim-admin/app/controllers/decidim/admin/components/base_controller.rb', line 60

def parent_path
  @parent_path ||= ::Decidim::EngineRouter.admin_proxy(current_participatory_space).components_path
end

#permission_class_chainObject


40
41
42
43
44
45
46
# File 'decidim-admin/app/controllers/decidim/admin/components/base_controller.rb', line 40

def permission_class_chain
  [
    current_component.manifest.permissions_class,
    current_participatory_space.manifest.permissions_class,
    Decidim::Admin::Permissions
  ]
end

#permission_scopeObject


48
49
50
# File 'decidim-admin/app/controllers/decidim/admin/components/base_controller.rb', line 48

def permission_scope
  :admin
end

#permissions_contextObject


33
34
35
36
37
38
# File 'decidim-admin/app/controllers/decidim/admin/components/base_controller.rb', line 33

def permissions_context
  super.merge(
    current_participatory_space: current_participatory_space,
    participatory_space: current_participatory_space
  )
end

#skip_manage_component_permissionObject


64
65
66
# File 'decidim-admin/app/controllers/decidim/admin/components/base_controller.rb', line 64

def skip_manage_component_permission
  false
end