Welcome to mirror list, hosted at ThFree Co, Russian Federation.

update_service.rb « group_links « groups « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 244ec2254a8497413d3861b4b31be007a86b28d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Groups
  module GroupLinks
    class UpdateService < ::Groups::BaseService
      def initialize(group_link, user = nil)
        super(group_link.shared_group, user)

        @group_link = group_link
      end

      def execute(group_link_params)
        group_link.update!(group_link_params)

        if requires_authorization_refresh?(group_link_params)
          group_link.shared_with_group.refresh_members_authorized_projects(blocking: false, direct_members_only: true)
        end
      end

      private

      attr_accessor :group_link

      def requires_authorization_refresh?(params)
        params.include?(:group_access)
      end
    end
  end
end