2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
class ProjectDeployToken < ApplicationRecord
|
2018-05-09 12:01:36 +05:30
|
|
|
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] }
|
2020-03-09 13:42:32 +05:30
|
|
|
|
|
|
|
def has_access_to?(requested_project)
|
|
|
|
requested_project == project
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|