2020-07-28 23:09:34 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Packages
|
|
|
|
module Conan
|
|
|
|
class PackageFinder
|
|
|
|
attr_reader :current_user, :query
|
|
|
|
|
|
|
|
def initialize(current_user, params)
|
|
|
|
@current_user = current_user
|
|
|
|
@query = params[:query]
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2021-06-08 01:23:25 +05:30
|
|
|
packages_for_current_user.installable.with_name_like(query).order_name_asc if query
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def packages
|
|
|
|
Packages::Package.conan
|
|
|
|
end
|
|
|
|
|
|
|
|
def packages_for_current_user
|
|
|
|
packages.for_projects(projects_visible_to_current_user)
|
|
|
|
end
|
|
|
|
|
|
|
|
def projects_visible_to_current_user
|
2022-07-01 11:34:44 +05:30
|
|
|
::Project.public_or_visible_to_user(current_user, ::Gitlab::Access::REPORTER)
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|