forked from saurabh/orbit4-5
optimization for authorization
This commit is contained in:
parent
6192cff3a1
commit
1a3b7d43d1
|
@ -78,6 +78,7 @@ class OrbitAdminController < ApplicationController
|
||||||
|
|
||||||
def load_authorized_categories
|
def load_authorized_categories
|
||||||
@user_authenticated_categories = current_user.is_admin? ? ["all"] : current_user.approved_categories.collect{|c| c.id} rescue []
|
@user_authenticated_categories = current_user.is_admin? ? ["all"] : current_user.approved_categories.collect{|c| c.id} rescue []
|
||||||
|
@current_user_is_sub_manager = current_user.is_sub_manager?(@module_app) rescue false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ module OrbitBackendHelper
|
||||||
create_user = obj.create_user_id.to_s rescue nil
|
create_user = obj.create_user_id.to_s rescue nil
|
||||||
if @user_authenticated_categories.first == "all"
|
if @user_authenticated_categories.first == "all"
|
||||||
return true
|
return true
|
||||||
elsif current_user.is_sub_manager?(@module_app) && !create_user.nil?
|
elsif @current_user_is_sub_manager && !create_user.nil?
|
||||||
create_user == current_user.id.to_s
|
create_user == current_user.id.to_s
|
||||||
else
|
else
|
||||||
@user_authenticated_categories.include?obj.category_id rescue (current_user.is_manager?(@module_app) rescue false)
|
@user_authenticated_categories.include?obj.category_id rescue (current_user.is_manager?(@module_app) rescue false)
|
||||||
|
|
Loading…
Reference in New Issue