Class: Groups::AcceptingProjectCreationsFinder
- Inherits:
-
Object
- Object
- Groups::AcceptingProjectCreationsFinder
- Defined in:
- app/finders/groups/accepting_project_creations_finder.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user) ⇒ AcceptingProjectCreationsFinder
constructor
A new instance of AcceptingProjectCreationsFinder.
Constructor Details
#initialize(current_user) ⇒ AcceptingProjectCreationsFinder
Returns a new instance of AcceptingProjectCreationsFinder.
5 6 7 |
# File 'app/finders/groups/accepting_project_creations_finder.rb', line 5 def initialize(current_user) @current_user = current_user end |
Instance Method Details
#execute ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/finders/groups/accepting_project_creations_finder.rb', line 9 def execute groups_accepting_project_creations = [ current_user .manageable_groups(include_groups_with_developer_maintainer_access: true) .project_creation_allowed(current_user), owner_maintainer_groups_originating_from_group_shares .project_creation_allowed(current_user), *developer_groups_originating_from_group_shares ] # We move the UNION query into a materialized CTE to improve query performance during text search. union_query = ::Group.from_union(groups_accepting_project_creations) cte = Gitlab::SQL::CTE.new(:my_union_cte, union_query) Group.with(cte.to_arel).from(cte.alias_to(Group.arel_table)) # rubocop: disable CodeReuse/ActiveRecord end |