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

rule.rb « protection « packages « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bb65be92b90f09b8282d65c41cce51e283185d70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Packages
  module Protection
    class Rule < ApplicationRecord
      enum package_type: Packages::Package.package_types.slice(:npm)

      belongs_to :project, inverse_of: :package_protection_rules

      validates :package_name_pattern, presence: true, uniqueness: { scope: [:project_id, :package_type] },
        length: { maximum: 255 }
      validates :package_type, presence: true
      validates :push_protected_up_to_access_level, presence: true,
        inclusion: { in: [
          Gitlab::Access::DEVELOPER,
          Gitlab::Access::MAINTAINER,
          Gitlab::Access::OWNER
        ] }
    end
  end
end