diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-01 12:17:40 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-01 12:17:40 +0000 |
commit | 5e98d2784081393aea84b6591116d905da6eb567 (patch) | |
tree | f18117de3f067c2511861c3d2343b7c951032dae /app/finders/groups/accepting_project_imports_finder.rb | |
parent | 2655540094e856f3048fb737a19e4316d8264623 (diff) | |
download | gitlab-ce-5e98d2784081393aea84b6591116d905da6eb567.tar.gz |
Add latest changes from gitlab-org/security/gitlab@15-10-stable-ee
Diffstat (limited to 'app/finders/groups/accepting_project_imports_finder.rb')
-rw-r--r-- | app/finders/groups/accepting_project_imports_finder.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/finders/groups/accepting_project_imports_finder.rb b/app/finders/groups/accepting_project_imports_finder.rb new file mode 100644 index 00000000000..55d72edf7bb --- /dev/null +++ b/app/finders/groups/accepting_project_imports_finder.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Groups + class AcceptingProjectImportsFinder + def initialize(current_user) + @current_user = current_user + end + + def execute + ::Group.from_union( + [ + current_user.manageable_groups, + managable_groups_originating_from_group_shares + ] + ) + end + + private + + attr_reader :current_user + + def managable_groups_originating_from_group_shares + GroupGroupLink + .with_owner_or_maintainer_access + .groups_accessible_via( + current_user.owned_or_maintainers_groups + .select(:id) + ) + end + end +end |