debian-mirror-gitlab/app/services/base_project_service.rb

27 lines
678 B
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
# Base class, scoped by project
class BaseProjectService < ::BaseContainerService
2021-11-18 22:05:49 +05:30
include ::Gitlab::Utils::StrongMemoize
2021-06-08 01:23:25 +05:30
attr_accessor :project
def initialize(project:, current_user: nil, params: {})
2022-10-02 17:18:49 +05:30
# we need to exclude project params since they may come from external requests. project should always
# be passed as part of the service's initializer
super(container: project, current_user: current_user, params: params.except(:project, :project_id))
2021-06-08 01:23:25 +05:30
@project = project
end
delegate :repository, to: :project
2021-11-18 22:05:49 +05:30
private
def project_group
strong_memoize(:project_group) do
project.group
end
end
2021-06-08 01:23:25 +05:30
end