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

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

module ContainerRegistry
  module Protection
    class Rule < ApplicationRecord
      enum delete_protected_up_to_access_level:
             Gitlab::Access.sym_options_with_owner.slice(:maintainer, :owner, :developer),
        _prefix: :delete_protected_up_to
      enum push_protected_up_to_access_level:
             Gitlab::Access.sym_options_with_owner.slice(:maintainer, :owner, :developer),
        _prefix: :push_protected_up_to

      belongs_to :project, inverse_of: :container_registry_protection_rules

      validates :container_path_pattern, presence: true, uniqueness: { scope: :project_id }, length: { maximum: 255 }
      validates :delete_protected_up_to_access_level, presence: true
      validates :push_protected_up_to_access_level, presence: true
    end
  end
end