Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

has_many grouped objects work again

  • Loading branch information...
commit d2cd13cb1c9bb7dff25aefaf5b14343d7d843591 1 parent 21560b5
@pschrammel authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/active_acl/handler/object_handler.rb
View
3  lib/active_acl/handler/object_handler.rb
@@ -44,6 +44,7 @@ def has_privilege?(requester,privilege,target=nil)
#todo check cash l2
vars={'requester_id' => requester.id}
+ vars['requester_group_id'] = requester.send(association_foreign_key) if !self.habtm? && self.grouped?
sql = ''
sql << query_r_select
if target
@@ -60,6 +61,7 @@ def has_privilege?(requester,privilege,target=nil)
if t_handler.grouped?
order << "(CASE WHEN t_g_links.acl_id IS NULL THEN 0 ELSE 1 END) ASC"
order << t_handler.group_handler.order_by(target,true)
+ vars['target_group_id'] = target.send(t_handler.association_foreign_key) unless t_handler.habtm?
end
order << 'acls.updated_at DESC'
sql << order.join(',')
@@ -68,7 +70,6 @@ def has_privilege?(requester,privilege,target=nil)
vars['privilege_id'] = privilege.id
vars['target_id'] = target.id
vars['target_type'] = target.class.base_class.name
- #vars['target_group_id'] = t_handler. association_foreign_key unless t_handler.habtm?
else
sql << " WHERE "
sql << query_r_where_2d
Please sign in to comment.
Something went wrong with that request. Please try again.