diff options
author | Patricio Cano <suprnova32@gmail.com> | 2016-09-01 18:49:48 -0500 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2016-09-15 12:27:32 -0500 |
commit | fd621429508ba3877e27a8187f0d491576b65ad0 (patch) | |
tree | 827492a8a13dff86ae72705419b2d4045f543598 /app/models | |
parent | f8bd9625f44ae4233c14e473c57becfb7ff15ca9 (diff) | |
download | gitlab-ce-fd621429508ba3877e27a8187f0d491576b65ad0.tar.gz |
Added group-specific setting for LFS.
Groups can enable/disable LFS, but this setting can be overridden at the project level. Admin only
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/group.rb | 7 | ||||
-rw-r--r-- | app/models/namespace.rb | 5 | ||||
-rw-r--r-- | app/models/project.rb | 9 |
3 files changed, 18 insertions, 3 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index c48869ae465..aefb94b2ada 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -95,6 +95,13 @@ class Group < Namespace end end + def lfs_enabled? + return false unless Gitlab.config.lfs.enabled + return Gitlab.config.lfs.enabled if self[:lfs_enabled].nil? + + self[:lfs_enabled] + end + def add_users(user_ids, access_level, current_user: nil, expires_at: nil) user_ids.each do |user_id| Member.add_user( diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 7c29d27ce97..919b3b1f095 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -141,6 +141,11 @@ class Namespace < ActiveRecord::Base projects.joins(:forked_project_link).find_by('forked_project_links.forked_from_project_id = ?', project.id) end + def lfs_enabled? + # User namespace will always default to the global setting + Gitlab.config.lfs.enabled + end + private def repository_storage_paths diff --git a/app/models/project.rb b/app/models/project.rb index f3f3ffbbd28..8e3bedffe1f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -393,10 +393,13 @@ class Project < ActiveRecord::Base end def lfs_enabled? - return false unless Gitlab.config.lfs.enabled - return Gitlab.config.lfs.enabled if self[:lfs_enabled].nil? + # Specifically check is lfs_enabled is false + return false if self[:lfs_enabled] == false - self[:lfs_enabled] + # Should only fallback to the namespace value if no value is set for the project + return namespace.lfs_enabled? if self[:lfs_enabled].nil? + + self[:lfs_enabled] && Gitlab.config.lfs.enabled end def repository_storage_path |