2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
class LfsFileLock < ApplicationRecord
|
2018-03-17 18:26:18 +05:30
|
|
|
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
|