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


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

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

#current_participatory_spaceObject


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

def current_participatory_space
  current_component.participatory_space
end

#parent_pathObject


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

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

#permission_class_chainObject


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

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

#permission_scopeObject


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

def permission_scope
  :admin
end

#permissions_contextObject


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

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

#skip_manage_component_permissionObject


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

def skip_manage_component_permission
  false
end