Module: Card::Set::Self::Admin
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-card/mod001-core/self/admin.rb,
platypus/tmp/set/gem-defaults/mod032-recaptcha/self/admin.rb,
platypus/tmp/set/gem-defaults/mod016-carrierwave/self/admin.rb
Overview
Set: The card “Admin”
Defined Under Namespace
Modules: HtmlFormat
Constant Summary
Constants included from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included from Event::Api
Class Method Summary collapse
Instance Method Summary collapse
-
#event: admin_tasks ⇒ Object
-
#irreversibles_tasks_allowed? ⇒ Boolean
-
#no_email_delivery? ⇒ Boolean
(eg #my_warning_message).
-
#not_allowed(task) ⇒ Object
-
#recaptcha_config_issues? ⇒ Boolean
-
#run_task_from_task_basket(task, task_config) ⇒ Object
Methods included from Card::Set
Methods included from I18nScope
Methods included from Registrar
#extended, #finalize_load, #process_base_modules, #register_set
Methods included from Helpers
#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name
Methods included from AdvancedApi
#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Class Method Details
.source_location ⇒ Object
7 |
# File 'platypus/tmp/set/gem-card/mod001-core/self/admin.rb', line 7 def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/self/admin.rb"; end |
Instance Method Details
#event: admin_tasks ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'platypus/tmp/set/gem-card/mod001-core/self/admin.rb', line 31 event :admin_tasks, :initialize, on: :update do return unless (task = Env.params[:task]&.to_sym) && (task_config = basket[:tasks][task]) raise Card::Error::PermissionDenied, self unless Auth.always_ok? # when :repair_references then Card::Reference.repair_all # when :repair_permissions then Card.repair_all_permissions # # when :regenerate_scripts then Card::Assets.refresh_scripts # when :clear_history # not_allowed "clear history" unless irreversibles_tasks_allowed? # Card::Action.delete_old run_task_from_task_basket task, task_config abort :success end |
#irreversibles_tasks_allowed? ⇒ Boolean
60 61 62 |
# File 'platypus/tmp/set/gem-card/mod001-core/self/admin.rb', line 60 def irreversibles_tasks_allowed? Cardio.config.allow_irreversible_admin_tasks end |
#no_email_delivery? ⇒ Boolean
(eg #my_warning_message).
27 28 29 |
# File 'platypus/tmp/set/gem-card/mod001-core/self/admin.rb', line 27 def no_email_delivery? Card.config.action_mailer.perform_deliveries == false end |
#not_allowed(task) ⇒ Object
54 55 56 57 58 |
# File 'platypus/tmp/set/gem-card/mod001-core/self/admin.rb', line 54 def not_allowed task raise Card::Error::PermissionDenied, "The admin task '#{task}' is disabled for security reasons.<br>"\ "You can enable it with the config option 'allow_irreversible_admin_tasks'" end |
#recaptcha_config_issues? ⇒ Boolean
10 11 12 |
# File 'platypus/tmp/set/gem-defaults/mod032-recaptcha/self/admin.rb', line 10 def recaptcha_config_issues? RecaptchaCard.using_defaults? end |
#run_task_from_task_basket(task, task_config) ⇒ Object
46 47 48 49 50 51 52 |
# File 'platypus/tmp/set/gem-card/mod001-core/self/admin.rb', line 46 def run_task_from_task_basket task, task_config if !irreversibles_tasks_allowed? && task_config[:irreversible] not_allowed t("#{task_config[:mod]}_task_#{task}_link_text") else task_config[:execute_policy]&.call end end |