diff options
author | Rubén Dávila <ruben@gitlab.com> | 2018-02-07 08:00:53 -0500 |
---|---|---|
committer | Rubén Dávila <ruben@gitlab.com> | 2018-02-07 09:04:00 -0500 |
commit | bed948321173b49564f39837e97212ee4dd96e03 (patch) | |
tree | 72e6faa9f68378f997f876cf9550561bad546028 /app/models/lfs_file_lock.rb | |
parent | ead97c55eac773444dee547a934112aa282c2e2e (diff) | |
download | gitlab-ce-bed948321173b49564f39837e97212ee4dd96e03.tar.gz |
Backport of LFS File Locking APIrd-35856-backport-lfs-file-locking-api
Diffstat (limited to 'app/models/lfs_file_lock.rb')
-rw-r--r-- | app/models/lfs_file_lock.rb | 12 |
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 |