39 lines
869 B
Ruby
39 lines
869 B
Ruby
class OrbitBackendController < ApplicationController
|
|
include OrbitCoreLib::AppBackendUtility
|
|
include OrbitCoreLib::PermissionUtility
|
|
include OrbitTag::Tagging
|
|
include AdminHelper
|
|
include ApplicationHelper
|
|
|
|
layout 'new_admin'
|
|
|
|
def setup_vars
|
|
@app_title ||= controller_path.split('/')[1].singularize
|
|
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
|
|
raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil?
|
|
end
|
|
|
|
private
|
|
|
|
def force_order_for_visitor
|
|
check_backend_openness
|
|
setup_vars
|
|
set_current_user
|
|
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
|
|
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
|
|
redirect_to root_url
|
|
end
|
|
end
|
|
end
|