diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/group.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index c459530..993d274 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -11,4 +11,17 @@ class Group < ActiveRecord::Base def to_s self.name end + + def permission_targets(permission) + group_permissions.where(:permission => permission).pluck(:target_group_id) + end + + def self.union(sets=[]) + group_ids = [] + sets.each do |set| + group_ids = group_ids + set + end + + return group_ids.uniq + end end |