Class: AdminSuite::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/admin_suite/configuration.rb

Overview

Configuration object for AdminSuite.

Defined Under Namespace

Classes: McpConfig

Constant Summary collapse

REQUIRED_AUTHORIZE_KEYWORDS =

The authorize hook's keywords are validated at assignment rather than at call time: a hook with the pre-0.6.0 controller: keyword would otherwise raise deep inside a request (or, worse, bind context: to nothing and silently mis-evaluate). Failing in the initializer puts the error where the mistake is.

i[actor action resource record context].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Configuration

Returns a new instance of Configuration.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/admin_suite/configuration.rb', line 103

def initialize
  @authenticate = nil
  @current_actor = nil
  @authorize = nil
  @auth_strategy = nil
  @auth_options = {}
  @allow_unauthenticated = false
  @skip_host_before_actions = [ :require_authentication ]
  @logout_path = nil
  @logout_method = :delete
  @logout_label = "Log out"
  @resource_globs = []
  @action_globs = []
  @portal_globs = []
  @dashboard_globs = []
  @portals = {}
  @portals_configured = false
  @custom_renderers = {}
  @icon_renderer = nil
  @docs_url = nil
  @docs_path = Rails.root.join("docs")
  @partials = {}
  @theme = { primary: :indigo, secondary: :purple }
  @host_stylesheet = nil
  @root_dashboard_title = nil
  @root_dashboard_description = nil
  @root_dashboard_definition = nil
  @root_dashboard_loaded = false
  @on_action_executed = nil
  @resolve_action_handler = nil
  @mcp = McpConfig.new(enabled: true, max_page_size: AdminSuite::Query::MAX_PAGE_SIZE)
end

Instance Attribute Details

#action_globs ⇒ Object

Returns the value of attribute action_globs.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def action_globs
  @action_globs
end

#allow_unauthenticated ⇒ Object

Returns the value of attribute allow_unauthenticated.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def allow_unauthenticated
  @allow_unauthenticated
end

#auth_options ⇒ Object

Returns the value of attribute auth_options.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def auth_options
  @auth_options
end

#auth_strategy ⇒ Object

Returns the value of attribute auth_strategy.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def auth_strategy
  @auth_strategy
end

#authenticate ⇒ Object

Returns the value of attribute authenticate.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def authenticate
  @authenticate
end

#authorize ⇒ Object

Returns the value of attribute authorize.



35
36
37
# File 'lib/admin_suite/configuration.rb', line 35

def authorize
  @authorize
end

#current_actor ⇒ Object

Returns the value of attribute current_actor.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def current_actor
  @current_actor
end

#custom_renderers ⇒ Object

Returns the value of attribute custom_renderers.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def custom_renderers
  @custom_renderers
end

#dashboard_globs ⇒ Object

Returns the value of attribute dashboard_globs.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def dashboard_globs
  @dashboard_globs
end

#docs_path ⇒ Object

Returns the value of attribute docs_path.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def docs_path
  @docs_path
end

#docs_url ⇒ Object

Returns the value of attribute docs_url.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def docs_url
  @docs_url
end

#host_stylesheet ⇒ Object

Returns the value of attribute host_stylesheet.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def host_stylesheet
  @host_stylesheet
end

#icon_renderer ⇒ Object

Returns the value of attribute icon_renderer.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def icon_renderer
  @icon_renderer
end

#logout_label ⇒ Object

Returns the value of attribute logout_label.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def logout_label
  @logout_label
end

#logout_method ⇒ Object

Returns the value of attribute logout_method.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def logout_method
  @logout_method
end

#logout_path ⇒ Object

Returns the value of attribute logout_path.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def logout_path
  @logout_path
end

#mcp ⇒ Object (readonly)

Returns the value of attribute mcp.



35
36
37
# File 'lib/admin_suite/configuration.rb', line 35

def mcp
  @mcp
end

#on_action_executed ⇒ Object

Returns the value of attribute on_action_executed.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def on_action_executed
  @on_action_executed
end

#partials ⇒ Object

Returns the value of attribute partials.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def partials
  @partials
end

#portal_globs ⇒ Object

Returns the value of attribute portal_globs.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def portal_globs
  @portal_globs
end

#portals ⇒ Object

Returns the value of attribute portals.



35
36
37
# File 'lib/admin_suite/configuration.rb', line 35

def portals
  @portals
end

#resolve_action_handler ⇒ Object

Returns the value of attribute resolve_action_handler.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def resolve_action_handler
  @resolve_action_handler
end

#resource_globs ⇒ Object

Returns the value of attribute resource_globs.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def resource_globs
  @resource_globs
end

#root_dashboard_definition ⇒ Object

Returns the value of attribute root_dashboard_definition.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def root_dashboard_definition
  @root_dashboard_definition
end

#root_dashboard_description ⇒ Object

Returns the value of attribute root_dashboard_description.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def root_dashboard_description
  @root_dashboard_description
end

#root_dashboard_loaded ⇒ Object

Returns the value of attribute root_dashboard_loaded.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def root_dashboard_loaded
  @root_dashboard_loaded
end

#root_dashboard_title ⇒ Object

Returns the value of attribute root_dashboard_title.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def root_dashboard_title
  @root_dashboard_title
end

#skip_host_before_actions ⇒ Object

Returns the value of attribute skip_host_before_actions.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def skip_host_before_actions
  @skip_host_before_actions
end

#theme ⇒ Object

Returns the value of attribute theme.



6
7
8
# File 'lib/admin_suite/configuration.rb', line 6

def theme
  @theme
end

Instance Method Details

#default_portals!(value) ⇒ Object

Sets the built-in default portals without marking portals as host-configured.

Engine-internal: public so AdminSuite::Engine.apply_default_portals! can call it directly, without reaching past Configuration's privacy via send. Not part of the host-facing configuration API -- a host app should never call this itself; use config.portals = { ... } (or config.portals = {} to suppress the built-in defaults). This deliberately bypasses the public portals= writer so gem-applied defaults stay distinguishable from an explicit host assignment (including an explicit {} meant to suppress defaults).



147
148
149
# File 'lib/admin_suite/configuration.rb', line 147

def default_portals!(value)
  @portals = value
end

#portals_configured? ⇒ Boolean

True once the host has assigned config.portals itself, distinct from the engine having applied its own defaults.

Returns:

  • (Boolean)


99
100
101
# File 'lib/admin_suite/configuration.rb', line 99

def portals_configured?
  @portals_configured == true
end