iron_admin 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +129 -1
- data/README.md +48 -1
- data/UPGRADING.md +495 -8
- data/app/assets/tailwind/iron_admin/engine.css +79 -4
- data/app/components/iron_admin/dashboards/activity_feed_component/item_component.html.haml +6 -9
- data/app/components/iron_admin/dashboards/activity_feed_component.html.haml +6 -5
- data/app/components/iron_admin/dashboards/activity_feed_component.rb +21 -24
- data/app/components/iron_admin/dashboards/chart_component.html.haml +3 -5
- data/app/components/iron_admin/dashboards/chart_component.rb +86 -24
- data/app/components/iron_admin/dashboards/concerns/themed_card.rb +39 -0
- data/app/components/iron_admin/dashboards/metric_card_component.html.haml +8 -7
- data/app/components/iron_admin/dashboards/metric_card_component.rb +2 -0
- data/app/components/iron_admin/dashboards/progress_component.html.haml +11 -7
- data/app/components/iron_admin/dashboards/progress_component.rb +11 -6
- data/app/components/iron_admin/dashboards/quick_links_component/link_component.html.haml +8 -9
- data/app/components/iron_admin/dashboards/quick_links_component.html.haml +6 -5
- data/app/components/iron_admin/dashboards/quick_links_component.rb +4 -12
- data/app/components/iron_admin/dashboards/recent_table_component.html.haml +15 -10
- data/app/components/iron_admin/dashboards/recent_table_component.rb +49 -0
- data/app/components/iron_admin/dashboards/stats_grid_component/stat_component.html.haml +13 -14
- data/app/components/iron_admin/dashboards/stats_grid_component.html.haml +1 -0
- data/app/components/iron_admin/dashboards/stats_grid_component.rb +9 -11
- data/app/components/iron_admin/filters/bar_component.html.haml +8 -6
- data/app/components/iron_admin/filters/bar_component.rb +56 -9
- data/app/components/iron_admin/filters/control_styles.rb +82 -0
- data/app/components/iron_admin/filters/date_range_component.html.haml +9 -4
- data/app/components/iron_admin/filters/date_range_component.rb +10 -6
- data/app/components/iron_admin/filters/search_component.html.haml +4 -4
- data/app/components/iron_admin/filters/search_component.rb +3 -5
- data/app/components/iron_admin/filters/select_filter_component.html.haml +1 -1
- data/app/components/iron_admin/filters/select_filter_component.rb +5 -16
- data/app/components/iron_admin/form/belongs_to_autocomplete_component.html.haml +9 -5
- data/app/components/iron_admin/form/belongs_to_autocomplete_component.rb +10 -8
- data/app/components/iron_admin/form/belongs_to_component.html.haml +2 -2
- data/app/components/iron_admin/form/belongs_to_component.rb +4 -18
- data/app/components/iron_admin/form/checkbox_component.rb +2 -3
- data/app/components/iron_admin/form/concerns/form_input_behavior.rb +1 -1
- data/app/components/iron_admin/form/control_classes.rb +108 -0
- data/app/components/iron_admin/form/date_picker_component.rb +3 -7
- data/app/components/iron_admin/form/field_wrapper_component.html.haml +3 -3
- data/app/components/iron_admin/form/field_wrapper_component.rb +3 -3
- data/app/components/iron_admin/form/nested_form_component.html.haml +4 -5
- data/app/components/iron_admin/form/nested_form_component.rb +12 -2
- data/app/components/iron_admin/form/select_component.html.haml +1 -1
- data/app/components/iron_admin/form/select_component.rb +2 -16
- data/app/components/iron_admin/form/text_input_component.rb +1 -5
- data/app/components/iron_admin/form/textarea_component.rb +1 -5
- data/app/components/iron_admin/layout/flash_component.html.haml +1 -1
- data/app/components/iron_admin/layout/flash_component.rb +4 -3
- data/app/components/iron_admin/layout/navbar_component.html.haml +15 -9
- data/app/components/iron_admin/layout/navbar_component.rb +29 -1
- data/app/components/iron_admin/layout/shell_component.html.haml +4 -4
- data/app/components/iron_admin/layout/shell_component.rb +16 -3
- data/app/components/iron_admin/layout/sidebar_component.html.haml +21 -25
- data/app/components/iron_admin/layout/sidebar_component.rb +76 -1
- data/app/components/iron_admin/layout/theme_switcher_component.html.haml +15 -0
- data/app/components/iron_admin/layout/theme_switcher_component.rb +74 -0
- data/app/components/iron_admin/resources/actions_component.html.haml +15 -8
- data/app/components/iron_admin/resources/actions_component.rb +34 -2
- data/app/components/iron_admin/resources/breadcrumb_component.html.haml +3 -3
- data/app/components/iron_admin/resources/breadcrumb_component.rb +8 -7
- data/app/components/iron_admin/resources/bulk_actions_component.html.haml +9 -8
- data/app/components/iron_admin/resources/bulk_actions_component.rb +47 -4
- data/app/components/iron_admin/resources/data_table_component.html.haml +15 -15
- data/app/components/iron_admin/resources/data_table_component.rb +34 -3
- data/app/components/iron_admin/resources/related_list_component.html.haml +7 -7
- data/app/components/iron_admin/resources/related_list_component.rb +26 -2
- data/app/components/iron_admin/resources/show_field_component.html.haml +3 -3
- data/app/components/iron_admin/resources/show_field_component.rb +10 -4
- data/app/components/iron_admin/resources/styles.rb +136 -0
- data/app/components/iron_admin/ui/alert_component.html.haml +2 -2
- data/app/components/iron_admin/ui/alert_component.rb +27 -31
- data/app/components/iron_admin/ui/badge_component.rb +40 -20
- data/app/components/iron_admin/ui/button_component.rb +37 -11
- data/app/components/iron_admin/ui/card_component.rb +3 -3
- data/app/components/iron_admin/ui/dropdown_component.html.haml +1 -1
- data/app/components/iron_admin/ui/dropdown_component.rb +34 -13
- data/app/components/iron_admin/ui/empty_state_component.html.haml +4 -5
- data/app/components/iron_admin/ui/empty_state_component.rb +2 -2
- data/app/components/iron_admin/ui/modal_component.html.haml +5 -5
- data/app/components/iron_admin/ui/modal_component.rb +6 -4
- data/app/components/iron_admin/ui/pagination_component.html.haml +14 -14
- data/app/components/iron_admin/ui/pagination_component.rb +26 -9
- data/app/components/iron_admin/ui/scopes_component.html.haml +2 -2
- data/app/components/iron_admin/ui/scopes_component.rb +44 -11
- data/app/components/iron_admin/ui/tooltip_component.rb +11 -4
- data/app/controllers/iron_admin/application_controller.rb +58 -4
- data/app/controllers/iron_admin/audit_controller.rb +30 -6
- data/app/controllers/iron_admin/concerns/action_executable.rb +37 -0
- data/app/controllers/iron_admin/concerns/assignable_references.rb +149 -0
- data/app/controllers/iron_admin/concerns/authorizable.rb +11 -0
- data/app/controllers/iron_admin/concerns/blank_password_filterable.rb +21 -0
- data/app/controllers/iron_admin/concerns/event_emittable.rb +47 -7
- data/app/controllers/iron_admin/concerns/filterable.rb +34 -9
- data/app/controllers/iron_admin/concerns/nested_permittable.rb +5 -3
- data/app/controllers/iron_admin/concerns/nested_tenant_check.rb +159 -0
- data/app/controllers/iron_admin/concerns/polymorphic_references.rb +131 -0
- data/app/controllers/iron_admin/concerns/scopeable.rb +54 -7
- data/app/controllers/iron_admin/concerns/searchable.rb +3 -3
- data/app/controllers/iron_admin/concerns/tenant_assignable.rb +118 -0
- data/app/controllers/iron_admin/concerns/tenant_containment.rb +146 -0
- data/app/controllers/iron_admin/exports_controller.rb +2 -2
- data/app/controllers/iron_admin/imports_controller.rb +1 -1
- data/app/controllers/iron_admin/resources_controller.rb +48 -41
- data/app/controllers/iron_admin/search_controller.rb +1 -2
- data/app/controllers/iron_admin/themes_controller.rb +50 -0
- data/app/controllers/iron_admin/tools_controller.rb +58 -5
- data/app/helpers/iron_admin/action_form_helper.rb +19 -0
- data/app/helpers/iron_admin/application_helper.rb +93 -16
- data/app/helpers/iron_admin/assignable_records_helper.rb +32 -0
- data/app/helpers/iron_admin/component_overrides_helper.rb +9 -4
- data/app/helpers/iron_admin/field_display_helper.rb +88 -43
- data/app/helpers/iron_admin/related_records_helper.rb +51 -0
- data/app/helpers/iron_admin/theme_helper.rb +56 -46
- data/app/javascript/iron_admin/controllers/cp_bulk_select_controller.js +12 -0
- data/app/javascript/iron_admin/controllers/cp_chart_controller.js +4 -0
- data/app/javascript/iron_admin/controllers/cp_disclosure_controller.js +19 -0
- data/app/javascript/iron_admin/controllers/cp_search_shortcut_controller.js +39 -0
- data/app/javascript/iron_admin/index.js +4 -0
- data/app/views/iron_admin/audit/index.html.haml +78 -81
- data/app/views/iron_admin/dashboard/index.html.haml +10 -9
- data/app/views/iron_admin/form/_action_field.html.haml +50 -0
- data/app/views/iron_admin/form/_nested_row.html.haml +18 -13
- data/app/views/iron_admin/imports/new.html.haml +14 -13
- data/app/views/iron_admin/imports/preview.html.haml +24 -21
- data/app/views/iron_admin/resources/_form.html.haml +70 -68
- data/app/views/iron_admin/resources/action_form.html.haml +16 -59
- data/app/views/iron_admin/resources/bulk_action_form.html.haml +20 -58
- data/app/views/iron_admin/resources/edit.html.haml +3 -3
- data/app/views/iron_admin/resources/index.html.haml +87 -74
- data/app/views/iron_admin/resources/new.html.haml +2 -2
- data/app/views/iron_admin/resources/show.html.haml +53 -41
- data/app/views/iron_admin/search/index.html.haml +17 -9
- data/app/views/iron_admin/shared/_pagination.html.haml +13 -10
- data/app/views/iron_admin/shared/error.html.haml +16 -12
- data/app/views/iron_admin/tools/action_form.html.haml +9 -55
- data/app/views/iron_admin/tools/show.html.haml +4 -5
- data/app/views/layouts/iron_admin/_document_head.html.haml +24 -0
- data/app/views/layouts/iron_admin/application.html.haml +4 -17
- data/app/views/layouts/iron_admin/minimal.html.haml +7 -0
- data/config/importmap.rb +2 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +1 -0
- data/docs/FAQ.md +87 -37
- data/docs/README.md +8 -2
- data/docs/components/README.md +6 -2
- data/docs/components/dashboard-components.md +24 -35
- data/docs/components/filter-components.md +44 -92
- data/docs/components/form-components.md +16 -32
- data/docs/components/resource-components.md +46 -27
- data/docs/components/ui-components.md +44 -26
- data/docs/getting-started/installation.md +5 -1
- data/docs/getting-started/quick-start.md +36 -23
- data/docs/guides/authentication.md +182 -42
- data/docs/guides/components.md +97 -15
- data/docs/guides/custom-adapters.md +24 -4
- data/docs/guides/dashboard.md +68 -44
- data/docs/guides/export.md +24 -8
- data/docs/guides/extending.md +206 -51
- data/docs/guides/fields.md +229 -70
- data/docs/guides/imports.md +33 -18
- data/docs/guides/resources.md +333 -111
- data/docs/guides/theming.md +930 -58
- data/docs/guides/troubleshooting.md +7 -3
- data/docs/plugin-system-design.md +8 -7
- data/docs/reference/configuration.md +51 -16
- data/docs/reference/routes.md +1 -0
- data/docs/reference/theme-properties.md +101 -38
- data/lib/generators/iron_admin/install/templates/initializer.rb.tt +7 -2
- data/lib/generators/iron_admin/install_audit/templates/create_iron_admin_audit_entries.rb.tt +2 -0
- data/lib/iron_admin/action_field.rb +11 -0
- data/lib/iron_admin/adapters/active_record.rb +95 -0
- data/lib/iron_admin/adapters/base.rb +107 -0
- data/lib/iron_admin/adapters/http/query.rb +21 -0
- data/lib/iron_admin/adapters/http.rb +84 -4
- data/lib/iron_admin/adapters/mongoid.rb +96 -2
- data/lib/iron_admin/audit_log.rb +64 -6
- data/lib/iron_admin/authentication_warning.rb +31 -0
- data/lib/iron_admin/concerns/filter_definable.rb +15 -1
- data/lib/iron_admin/concerns/nestable.rb +25 -0
- data/lib/iron_admin/concerns/scope_countable.rb +56 -0
- data/lib/iron_admin/concerns/soft_deletable.rb +28 -9
- data/lib/iron_admin/configuration/components.rb +14 -3
- data/lib/iron_admin/configuration/theme/neutral_defaults.rb +179 -0
- data/lib/iron_admin/configuration/theme.rb +292 -87
- data/lib/iron_admin/configuration.rb +340 -45
- data/lib/iron_admin/dashboard.rb +22 -38
- data/lib/iron_admin/engine.rb +16 -2
- data/lib/iron_admin/errors.rb +3 -0
- data/lib/iron_admin/field.rb +78 -17
- data/lib/iron_admin/field_inferrer.rb +61 -3
- data/lib/iron_admin/field_override_warning.rb +67 -0
- data/lib/iron_admin/import/import_preview.rb +56 -7
- data/lib/iron_admin/import/importer.rb +91 -14
- data/lib/iron_admin/import/tenant_precheck.rb +67 -0
- data/lib/iron_admin/plugin/registration.rb +64 -0
- data/lib/iron_admin/plugin_registry.rb +3 -2
- data/lib/iron_admin/policy.rb +22 -12
- data/lib/iron_admin/policy_coverage_warning.rb +46 -0
- data/lib/iron_admin/request_context.rb +18 -0
- data/lib/iron_admin/resource.rb +218 -77
- data/lib/iron_admin/resource_registry.rb +86 -13
- data/lib/iron_admin/scope_counts.rb +73 -0
- data/lib/iron_admin/tenant_scope.rb +30 -0
- data/lib/iron_admin/tool.rb +61 -12
- data/lib/iron_admin/tool_context.rb +10 -6
- data/lib/iron_admin/version.rb +1 -1
- data/lib/iron_admin.rb +29 -2
- metadata +37 -7
|
@@ -14,6 +14,7 @@ module IronAdmin
|
|
|
14
14
|
# - {#menu_item} — contribute a custom sidebar link
|
|
15
15
|
# - {#component} — override a global UI component
|
|
16
16
|
# - {#field_type} — register a custom field type renderer
|
|
17
|
+
# - {#theme} — register a named theme
|
|
17
18
|
#
|
|
18
19
|
# == Planned extension points (design only — see docs/plugin-system-design.md)
|
|
19
20
|
#
|
|
@@ -73,6 +74,69 @@ module IronAdmin
|
|
|
73
74
|
|
|
74
75
|
FieldTypeRegistry.register(type_name, &)
|
|
75
76
|
end
|
|
77
|
+
|
|
78
|
+
# Registers a theme that starts from the pristine Neutral values and yields it,
|
|
79
|
+
# the same way {IronAdmin::Configuration#register_theme} does.
|
|
80
|
+
#
|
|
81
|
+
# The name is owned by this plugin's {IronAdmin::Plugin.plugin_name}. +plugin_name+ is a
|
|
82
|
+
# logical identity, not a proof that two implementations are the same: another
|
|
83
|
+
# plugin class that declares the same name is the same owner, and activating it
|
|
84
|
+
# does not rebuild the theme.
|
|
85
|
+
#
|
|
86
|
+
# - A free name is registered, and this plugin recorded as its owner, only after
|
|
87
|
+
# the block returns. A block that raises leaves neither a theme nor an owner.
|
|
88
|
+
# - Activating again (every Rails +to_prepare+) does nothing. The theme is not
|
|
89
|
+
# rebuilt, and its values and label are not applied again, so an adjustment the
|
|
90
|
+
# app made to the theme object stays until the process restarts.
|
|
91
|
+
# - A name owned by another plugin, or by the app (Neutral and any
|
|
92
|
+
# +config.register_theme+), raises {IronAdmin::PluginError} before anything is
|
|
93
|
+
# replaced. The message names the theme and both owners. Rename one theme, or
|
|
94
|
+
# remove one registration.
|
|
95
|
+
#
|
|
96
|
+
# A Symbol, a String and any other case are the same name.
|
|
97
|
+
#
|
|
98
|
+
# @note EXPERIMENTAL — unstable until 1.0. The plugin API is not covered by the
|
|
99
|
+
# zero-breaking-changes invariant and may change before GA.
|
|
100
|
+
#
|
|
101
|
+
# @param name [Symbol, String] Theme name, also the value of the theme cookie
|
|
102
|
+
# @param label [String] Switcher text (default: the titleized name)
|
|
103
|
+
# @yield [theme] The new theme, and only the first time this plugin registers it
|
|
104
|
+
# @yieldparam theme [IronAdmin::Configuration::Theme]
|
|
105
|
+
# @return [IronAdmin::Configuration::Theme] The registered theme
|
|
106
|
+
# @raise [IronAdmin::PluginError] Another owner already has the name
|
|
107
|
+
# @raise [ArgumentError] The name is blank
|
|
108
|
+
#
|
|
109
|
+
# @example A theme plugin
|
|
110
|
+
# # lib/iron_admin/theme/high_contrast.rb (in the theme gem)
|
|
111
|
+
# module IronAdmin
|
|
112
|
+
# module Theme
|
|
113
|
+
# class HighContrast < IronAdmin::Plugin
|
|
114
|
+
# plugin_name "iron_admin-theme-high_contrast"
|
|
115
|
+
#
|
|
116
|
+
# # A gem that ships CSS needs this engine_name, and
|
|
117
|
+
# # app/assets/tailwind/iron_admin_theme_high_contrast/engine.css.
|
|
118
|
+
# class Engine < Rails::Engine
|
|
119
|
+
# engine_name "iron_admin_theme_high_contrast"
|
|
120
|
+
# end
|
|
121
|
+
#
|
|
122
|
+
# setup do |admin|
|
|
123
|
+
# admin.theme(:high_contrast, label: "High Contrast") do |theme|
|
|
124
|
+
# theme.btn_primary = "bg-black text-white hover:bg-zinc-800 " \
|
|
125
|
+
# "focus-visible:outline-2 focus-visible:outline-offset-2 " \
|
|
126
|
+
# "focus-visible:outline-black"
|
|
127
|
+
# theme.link = "text-black underline hover:text-zinc-800"
|
|
128
|
+
# theme.swatch = "rounded-full bg-black ring-2 ring-black"
|
|
129
|
+
# end
|
|
130
|
+
# end
|
|
131
|
+
# end
|
|
132
|
+
# end
|
|
133
|
+
# end
|
|
134
|
+
#
|
|
135
|
+
# # In the host app's config/initializers/iron_admin.rb:
|
|
136
|
+
# IronAdmin.register_plugin(IronAdmin::Theme::HighContrast)
|
|
137
|
+
def theme(name, label: name.to_s.titleize, &)
|
|
138
|
+
IronAdmin.configuration.register_plugin_theme(@plugin.plugin_name, name, label: label, &)
|
|
139
|
+
end
|
|
76
140
|
end
|
|
77
141
|
end
|
|
78
142
|
end
|
|
@@ -43,8 +43,9 @@ module IronAdmin
|
|
|
43
43
|
# Re-activates every registered plugin.
|
|
44
44
|
#
|
|
45
45
|
# Called by the engine on boot/reload so component overrides and menu
|
|
46
|
-
# items survive the per-request configuration lifecycle.
|
|
47
|
-
#
|
|
46
|
+
# items survive the per-request configuration lifecycle. A plugin's
|
|
47
|
+
# theme is left as it was registered. Activation is idempotent, so
|
|
48
|
+
# repeated calls are safe.
|
|
48
49
|
#
|
|
49
50
|
# @return [void]
|
|
50
51
|
def activate_all!
|
data/lib/iron_admin/policy.rb
CHANGED
|
@@ -6,24 +6,34 @@ module IronAdmin
|
|
|
6
6
|
# Policies define which actions users can perform on resources.
|
|
7
7
|
# They use a simple DSL with `allow` and `deny` to manage permissions.
|
|
8
8
|
#
|
|
9
|
-
# When no policy is defined for a resource,
|
|
10
|
-
#
|
|
11
|
-
#
|
|
9
|
+
# When no policy is defined for a resource, {Configuration#default_policy}
|
|
10
|
+
# decides: +:allow+ (the default) allows every action, +:deny+ denies them all.
|
|
11
|
+
# Once a policy block exists, CRUD actions must be explicitly allowed
|
|
12
|
+
# ({#allowed?}). Custom actions and bulk actions stay allowed unless the
|
|
13
|
+
# policy names them ({#action_allowed?}). A deny rule wins over an allow rule.
|
|
12
14
|
#
|
|
13
15
|
# @example Basic policy in a resource
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
16
|
+
# module IronAdmin
|
|
17
|
+
# module Resources
|
|
18
|
+
# class UserResource < IronAdmin::Resource
|
|
19
|
+
# policy do
|
|
20
|
+
# allow :read # Everyone can view
|
|
21
|
+
# allow :create, :update, if: ->(user) { user.admin? }
|
|
22
|
+
# deny :destroy # No one can delete
|
|
23
|
+
# end
|
|
24
|
+
# end
|
|
19
25
|
# end
|
|
20
26
|
# end
|
|
21
27
|
#
|
|
22
28
|
# @example Policy with conditional deny
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
29
|
+
# module IronAdmin
|
|
30
|
+
# module Resources
|
|
31
|
+
# class OrderResource < IronAdmin::Resource
|
|
32
|
+
# policy do
|
|
33
|
+
# allow :read, :create, :update, :destroy
|
|
34
|
+
# deny :destroy, if: ->(user) { !user.superadmin? }
|
|
35
|
+
# end
|
|
36
|
+
# end
|
|
27
37
|
# end
|
|
28
38
|
# end
|
|
29
39
|
#
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module IronAdmin
|
|
4
|
+
# Lists, in development, the resources that have no +policy+ block while
|
|
5
|
+
# {Configuration#default_policy} is +:allow+: every user the authenticate
|
|
6
|
+
# block admits can run every action on them.
|
|
7
|
+
#
|
|
8
|
+
# The engine calls it after each load of the resources. It warns again only
|
|
9
|
+
# when the list changes, so code reloads do not repeat it.
|
|
10
|
+
#
|
|
11
|
+
# @api private
|
|
12
|
+
module PolicyCoverageWarning
|
|
13
|
+
@last_warned = nil
|
|
14
|
+
|
|
15
|
+
class << self
|
|
16
|
+
# @param resources [Array<Class>] the registered resource classes
|
|
17
|
+
# @param env [ActiveSupport::EnvironmentInquirer]
|
|
18
|
+
# @param logger [#warn, nil]
|
|
19
|
+
# @return [Boolean] whether it warned
|
|
20
|
+
def call(resources: ResourceRegistry.all, env: Rails.env, logger: Rails.logger)
|
|
21
|
+
return false unless env.development? && IronAdmin.configuration.default_allow?
|
|
22
|
+
|
|
23
|
+
names = resources.reject(&:resource_policy).map(&:name).sort
|
|
24
|
+
return false if names.empty? || names == @last_warned
|
|
25
|
+
|
|
26
|
+
@last_warned = names
|
|
27
|
+
logger&.warn(message(names))
|
|
28
|
+
true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Forgets the last list, so the next call warns again.
|
|
32
|
+
# @return [void]
|
|
33
|
+
def reset!
|
|
34
|
+
@last_warned = nil
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def message(names)
|
|
40
|
+
"[IronAdmin] These resources have no policy, so every user the authenticate block admits " \
|
|
41
|
+
"can run every action on them: #{names.join(", ")}. Add a policy block to each, or set " \
|
|
42
|
+
"config.default_policy = :deny to deny resources without one."
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "active_support/current_attributes"
|
|
4
|
+
|
|
5
|
+
module IronAdmin
|
|
6
|
+
# Per-request state of the admin panel. Rails resets it around every request.
|
|
7
|
+
#
|
|
8
|
+
# This is not named Current. Resource files are written inside
|
|
9
|
+
# +module IronAdmin+, so a constant named Current there would hide the
|
|
10
|
+
# host application's ::Current.
|
|
11
|
+
#
|
|
12
|
+
# @see IronAdmin.current_theme
|
|
13
|
+
class RequestContext < ActiveSupport::CurrentAttributes
|
|
14
|
+
# @!attribute [rw] theme
|
|
15
|
+
# @return [IronAdmin::Configuration::Theme, nil] Theme resolved for the current request
|
|
16
|
+
attribute :theme
|
|
17
|
+
end
|
|
18
|
+
end
|