app/controllers/tr8n/api/v1/base_controller.rb in tr8n-3.2.0 vs app/controllers/tr8n/api/v1/base_controller.rb in tr8n-3.2.1
- old
+ new
@@ -20,10 +20,12 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
class Tr8n::Api::V1::BaseController < ApplicationController
+
+ before_filter :check_api_enabled
if Tr8n::Config.api_skip_before_filters.any?
skip_before_filter *Tr8n::Config.api_skip_before_filters
end
@@ -35,9 +37,13 @@
after_filter *Tr8n::Config.api_after_filters
end
private
+ def check_api_enabled
+ sanitize_api_response({"error" => "Api is disabled"}) unless Tr8n::Config.enable_api?
+ end
+
def tr8n_current_user
Tr8n::Config.current_user
end
helper_method :tr8n_current_user
\ No newline at end of file