2018-07-25 05:30:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-07 08:00:53 -05:00
|
|
|
class LfsFileLock < ActiveRecord::Base
|
|
|
|
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
|