Merge branch 'master' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into ydu

This commit is contained in:
Harry Bomrah 2014-11-14 16:57:52 +08:00
commit 124c840efa
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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