summaryrefslogtreecommitdiff
path: root/app/models/project_deploy_token.rb
blob: 0bce1c745f7de9678f342e3d0a62b7bb1668eefb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

class ProjectDeployToken < ApplicationRecord
  belongs_to :project
  belongs_to :deploy_token, inverse_of: :project_deploy_tokens

  validates :deploy_token, presence: true
  validates :project, presence: true
  validates :deploy_token_id, uniqueness: { scope: [:project_id] }

  def has_access_to?(requested_project)
    requested_project == project
  end
end