Class: GroupProjectsFinder

Inherits:
ProjectsFinder show all
Defined in:
app/finders/group_projects_finder.rb

Overview

GroupProjectsFinder

Used to filter Projects by set of params

Arguments:

current_user - which user use
project_ids_relation: int[] - project ids to use
group
options:
  exclude_shared: boolean
    When true, only projects within the group are included in the result.
  only_shared: boolean
    When true, only projects arising from group-project shares are included in the result.
  limit: integer
  include_subgroups: boolean
  include_ancestor_groups: boolean
params:
  sort: string
  visibility_level: int
  tags: string[]
  personal: boolean
  search: string
  non_archived: boolean
  with_issues_enabled: boolean
  with_merge_requests_enabled: boolean
  min_access_level: int
  owned: boolean

Constant Summary collapse

DEFAULT_PROJECTS_LIMIT =
100

Instance Attribute Summary collapse

Attributes inherited from ProjectsFinder

#current_user, #params, #project_ids_relation

Instance Method Summary collapse

Methods included from UpdatedAtFilter

#by_updated_at

Methods included from CustomAttributesFilter

#by_custom_attributes

Methods inherited from UnionFinder

#find_union

Constructor Details

#initialize(group:, params: {}, options: {}, current_user: nil, project_ids_relation: nil) ⇒ GroupProjectsFinder

Returns a new instance of GroupProjectsFinder.



36
37
38
39
40
41
42
43
44
# File 'app/finders/group_projects_finder.rb', line 36

def initialize(group:, params: {}, options: {}, current_user: nil, project_ids_relation: nil)
  super(
    params: params,
    current_user: current_user,
    project_ids_relation: project_ids_relation
  )
  @group = group
  @options = options
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



34
35
36
# File 'app/finders/group_projects_finder.rb', line 34

def group
  @group
end

#optionsObject (readonly)

Returns the value of attribute options.



34
35
36
# File 'app/finders/group_projects_finder.rb', line 34

def options
  @options
end

Instance Method Details

#executeObject



46
47
48
49
# File 'app/finders/group_projects_finder.rb', line 46

def execute
  collection = super
  limit(collection)
end