Add require_config_enabled to Api::V1::BaseController

This commit is contained in:
Patrick Gansterer 2021-02-18 11:17:33 +01:00
parent 17434a038a
commit 9d68abd908

View file

@ -39,6 +39,12 @@ class Api::V1::BaseController < ApplicationController
end
end
def require_config_enabled(config)
unless FoodsoftConfig[config]
raise Api::Errors::PermissionRequired.new(t('application.controller.error_not_enabled', config: config))
end
end
def skip_session
request.session_options[:skip] = true
end