From 6a40a9555a22ca2f3a32909ff804f42b47613314 Mon Sep 17 00:00:00 2001 From: "Matt K. Fu" Date: Wed, 26 Jun 2013 10:46:50 +0800 Subject: [PATCH] fix query for un-permitted category use --- lib/orbit_core_lib.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index a6c19f5ed..d050390d0 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -79,9 +79,10 @@ module OrbitCoreLib else auth_object_space = ObjectAuth.where(obj_authable_type: self.to_s,title: title) end - query1 = auth_object_space.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: user.id) - query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id},{role_ids: user.role_ids}).excludes(blocked_user_ids: user.id) + query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id}).excludes(blocked_user_ids: user.id) + # query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id},{role_ids: user.role_ids}).excludes(blocked_user_ids: user.id) #save for backup if something went wrong (0626 Matt) + result = (query1 + query2).uniq result.collect{|t| t.obj_authable}.delete_if{|val| val==nil} end