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

class LfsFileLock < ApplicationRecord
  belongs_to :project
  belongs_to :user

  validates :project_id, :user_id, :path, presence: true

  def can_be_unlocked_by?(current_user, forced = false)
    return true if current_user.id == user_id

    forced && current_user.can?(:admin_project, project)
  end
end