Add config option to disable the invites

Some foodcoops require that an admin adds all users to have more control
over the users.
This commit is contained in:
Patrick Gansterer 2016-03-06 13:56:33 +01:00
parent f5b6fbcf18
commit e16a0fb336
12 changed files with 25 additions and 11 deletions

View file

@ -132,7 +132,13 @@ class ApplicationController < ActionController::Base
#
def require_plugin_enabled(plugin)
unless plugin.enabled?
redirect_to root_path, alert: I18n.t('application.controller.error_plugin_disabled')
redirect_to root_path, alert: I18n.t('application.controller.error_feature_disabled')
end
end
def require_config_disabled(config)
if FoodsoftConfig[config]
redirect_to root_path, alert: I18n.t('application.controller.error_feature_disabled')
end
end

View file

@ -1,6 +1,7 @@
class InvitesController < ApplicationController
before_filter :authenticate_membership_or_admin_for_invites
before_filter -> { require_config_disabled :disable_invite }
def new
@invite = Invite.new(:user => @current_user, :group => @group)