diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-06 09:12:51 -0500 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-06 09:12:51 -0500 |
commit | 5ebafb77ecbfdb2cb22a6d3acdd4a9b56dca8ad0 (patch) | |
tree | e6abea6aa55db8cb3d56204a61ba5a097c6d432c | |
parent | 3c3f90f4b43a41187dd65af3fe08e0409b30b68a (diff) |
group methods added
-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 |