Class: GroupsFinder
- Inherits:
-
UnionFinder
- Object
- UnionFinder
- GroupsFinder
- Includes:
- CustomAttributesFilter
- Defined in:
- app/finders/groups_finder.rb
Overview
GroupsFinder
Used to filter Groups by a set of params
Arguments:
current_user - which user is requesting groups
params:
owned: boolean
parent: Group
all_available: boolean (defaults to true)
min_access_level: integer
search: string
exclude_group_ids: array of integers
filter_group_ids: array of integers - only include groups from the specified list of ids
include_parent_descendants: boolean (defaults to false) - includes descendant groups when
filtering by parent. The parent param must be present.
include_ancestors: boolean (defaults to true)
Users with full private access can see all groups. The ‘owned` and `parent` params can be used to restrict the groups that are returned.
Anonymous users will never return any ‘owned` groups. They will return all public groups instead, even if `all_available` is set to false.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user = nil, params = {}) ⇒ GroupsFinder
constructor
A new instance of GroupsFinder.
Methods included from CustomAttributesFilter
Methods inherited from UnionFinder
Constructor Details
#initialize(current_user = nil, params = {}) ⇒ GroupsFinder
Returns a new instance of GroupsFinder.
29 30 31 32 |
# File 'app/finders/groups_finder.rb', line 29 def initialize(current_user = nil, params = {}) @current_user = current_user @params = params end |
Instance Method Details
#execute ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/finders/groups_finder.rb', line 34 def execute items = all_groups.map do |groups| filter_groups(groups) end find_union(items, Group).with_route.order_id_desc end |