enable/disable plugins by config option

This commit is contained in:
wvengen 2014-04-05 18:47:16 +02:00
parent 6d98be6d22
commit 64bb8e043d
21 changed files with 65 additions and 15 deletions

View file

@ -104,6 +104,19 @@ class ApplicationController < ActionController::Base
end
end
# Many plugins can be turned on and off on the fly with a `use_` configuration option.
# To disable a controller in the plugin, you can use this as a `before_action`:
#
# class MypluginController < ApplicationController
# before_filter -> { require_plugin_enabled FoodsoftMyplugin }
# end
#
def require_plugin_enabled(plugin)
unless plugin.enabled?
redirect_to root_path, alert: I18n.t('application.controller.error_plugin_disabled')
end
end
# Redirect to the login page, used in authenticate, plugins can override this.
def redirect_to_login(options={})
redirect_to login_url, options