summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/group.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 6c65f70..849fa71 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -29,4 +29,12 @@ class Group < ActiveRecord::Base
return group_ids.uniq
end
+
+ def self.target_group_ids_by_permission(permission, *group_sets)
+ target_groups = []
+ group_sets.each do |groups|
+ target_groups = target_groups + Group.union(groups.collect{|g| g.permission_targets(permission)})
+ end
+ return target_groups.uniq
+ end
end