summaryrefslogtreecommitdiff
path: root/app/services/user_project_access_changed_service.rb
blob: adca43660e8f5906d1de1c56f88249d8d2762468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class UserProjectAccessChangedService
  def initialize(user_ids)
    @user_ids = Array.wrap(user_ids)
  end

  def execute(blocking: true)
    bulk_args = @user_ids.map { |id| [id] }

    if blocking
      AuthorizedProjectsWorker.bulk_perform_and_wait(bulk_args)
    else
      AuthorizedProjectsWorker.bulk_perform_async(bulk_args)
    end
  end
end