You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: append_storages_hosts_to_csp_hook.rb
    path of file: ./repos/openproject/modules/storages/lib/open_project/storages
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is fr
    
  def application_controller_before_action(context)
    storage_ids = ::Storages::ProjectStorage.where(
      project_id: Project.allowed_to(User.current, :manage_file_links)
    ).select(:storage_id)
    storages_hosts = ::Storages::Storage
      .where(id: storage_ids)
      .flat_map(&:connect_src)

    if storages_hosts.present?
      # secure_headers gem provides this helper method to append to the current content security policy
      context[:controller].append_content_security_policy_directives(connect_src: storages_hosts)
    end