summaryrefslogtreecommitdiff
path: root/app/models/lfs_file_lock.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/lfs_file_lock.rb')
-rw-r--r--app/models/lfs_file_lock.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/lfs_file_lock.rb b/app/models/lfs_file_lock.rb
new file mode 100644
index 00000000000..50bb6ca382d
--- /dev/null
+++ b/app/models/lfs_file_lock.rb
@@ -0,0 +1,12 @@
+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