This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/controllers/orbit_backend_controller.rb

39 lines
869 B
Ruby
Raw Normal View History

class OrbitBackendController < ApplicationController
2012-12-03 10:52:36 +00:00
include OrbitCoreLib::AppBackendUtility
include OrbitCoreLib::PermissionUtility
2013-04-26 03:18:57 +00:00
include OrbitTag::Tagging
2012-03-16 03:09:44 +00:00
include AdminHelper
2012-08-23 08:05:14 +00:00
include ApplicationHelper
layout 'new_admin'
def setup_vars
2012-11-20 07:47:07 +00:00
@app_title ||= controller_path.split('/')[1].singularize
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
2013-01-03 02:58:52 +00:00
raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil?
end
2012-04-29 15:39:28 +00:00
private
2012-08-23 08:05:14 +00:00
def force_order_for_visitor
check_backend_openness
setup_vars
set_current_user
2012-08-23 08:05:14 +00:00
end
def force_order_for_user
setup_vars
set_current_user
authenticate_user!
check_user_can_use
end
def check_user_can_use
unless check_permission
2012-04-26 08:45:46 +00:00
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
redirect_to root_url
end
end
end