forked from saurabh/orbit4-5
Merge branch 'master' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into ydu
This commit is contained in:
commit
124c840efa
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -138,8 +138,11 @@ module OrbitBackendHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_edit_or_delete?(obj)
|
def can_edit_or_delete?(obj)
|
||||||
|
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 && !create_user.nil?
|
||||||
|
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)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue