fix object auth. show error message if user try to do object auth in a wrong way.
This commit is contained in:
1 parent
9937b4ac9b
commit
32c6f17613
7 files changed
+68
-6
No files matched your search
@@ -4,7 +4,6 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||
|
||||
|
||||
def setting
|
||||
|
||||
@sys_users = User.all(conditions: {admin: false}).includes(:avatar).not_guest_user
|
||||
@ob_auth = ObjectAuth.find params[:object_auth_id]
|
||||
@options_from_collection_for_select_ob_auth = @ob_auth.siblings.collect{|oa| [oa.auth_obj.pp_object,oa.id] }
|
||||
@@ -60,6 +59,7 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||
|
||||
def force_order
|
||||
authenticate_user!
|
||||
setup_vars
|
||||
check_if_user_can_do_object_auth
|
||||
end
|
||||
|
||||
@@ -76,15 +76,25 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||
end
|
||||
|
||||
def setup_vars
|
||||
if request.env['HTTP_REFERER'].split('/')[4] == "object_auths"
|
||||
http_referer = request.env['HTTP_REFERER'] || ''
|
||||
if http_referer.split('/')[4] == "object_auths"
|
||||
@app_key = params[:app_key]
|
||||
else
|
||||
@app_key = request.env['HTTP_REFERER'].split('/')[4]
|
||||
@app_key = http_referer.split('/')[4]
|
||||
end
|
||||
|
||||
#@app_key = request.fullpath.split('/')[1] if(@app_key == "back_end")
|
||||
@app_key.gsub!(/[?].*/,'')
|
||||
@module_app = ModuleApp.first(conditions: {:key => @app_key} )
|
||||
if @app_key
|
||||
@app_key.gsub!(/[?].*/,'')
|
||||
@module_app = ModuleApp.first(conditions: {:key => @app_key} )
|
||||
if @module_app.nil?
|
||||
raise ObjectAuthError, 'Auth procress failed, module_app not exist '
|
||||
end
|
||||
else
|
||||
raise ObjectAuthError, 'Auth procress failed, pls redo your sop'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user