Commit 22c45a9e authored by Douwe Maan's avatar Douwe Maan

Merge branch 'jr-33320-lfs-settings-interface' into 'master'

Enable LFS setting UI for Masters and Owners

Closes #33320

See merge request gitlab-org/gitlab-ce!18562
parents 8b0b4ece 564050ec
...@@ -442,7 +442,7 @@ module ProjectsHelper ...@@ -442,7 +442,7 @@ module ProjectsHelper
visibilityHelpPath: help_page_path('public_access/public_access'), visibilityHelpPath: help_page_path('public_access/public_access'),
registryAvailable: Gitlab.config.registry.enabled, registryAvailable: Gitlab.config.registry.enabled,
registryHelpPath: help_page_path('user/project/container_registry'), registryHelpPath: help_page_path('user/project/container_registry'),
lfsAvailable: Gitlab.config.lfs.enabled && current_user.admin?, lfsAvailable: Gitlab.config.lfs.enabled,
lfsHelpPath: help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs') lfsHelpPath: help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
} }
......
- if current_user.admin? .form-group
.form-group = f.label :lfs_enabled, 'Large File Storage', class: 'control-label'
= f.label :lfs_enabled, 'Large File Storage', class: 'control-label' .col-sm-10
.col-sm-10 .checkbox
.checkbox = f.label :lfs_enabled do
= f.label :lfs_enabled do = f.check_box :lfs_enabled, checked: @group.lfs_enabled?
= f.check_box :lfs_enabled, checked: @group.lfs_enabled? %strong
%strong Allow projects within this group to use Git LFS
Allow projects within this group to use Git LFS = link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs') %br/
%br/ %span.descr This setting can be overridden in each project.
%span.descr This setting can be overridden in each project.
- if can? current_user, :admin_group, @group .form-group
.form-group = f.label :require_two_factor_authentication, 'Two-factor authentication', class: 'control-label col-sm-2'
= f.label :require_two_factor_authentication, 'Two-factor authentication', class: 'control-label col-sm-2' .col-sm-10
.col-sm-10 .checkbox
.checkbox = f.label :require_two_factor_authentication do
= f.label :require_two_factor_authentication do = f.check_box :require_two_factor_authentication
= f.check_box :require_two_factor_authentication %strong
%strong Require all users in this group to setup Two-factor authentication
Require all users in this group to setup Two-factor authentication = link_to icon('question-circle'), help_page_path('security/two_factor_authentication', anchor: 'enforcing-2fa-for-all-users-in-a-group')
= link_to icon('question-circle'), help_page_path('security/two_factor_authentication', anchor: 'enforcing-2fa-for-all-users-in-a-group') .form-group
.form-group .col-sm-offset-2.col-sm-10
.col-sm-offset-2.col-sm-10 .checkbox
.checkbox = f.text_field :two_factor_grace_period, class: 'form-control'
= f.text_field :two_factor_grace_period, class: 'form-control' .help-block Amount of time (in hours) that users are allowed to skip forced configuration of two-factor authentication
.help-block Amount of time (in hours) that users are allowed to skip forced configuration of two-factor authentication
---
title: Show group and project LFS settings in the interface to Owners and Masters
merge_request: 18562
author:
type: changed
...@@ -251,13 +251,4 @@ It is possible to host LFS objects externally by setting a custom LFS url with ` ...@@ -251,13 +251,4 @@ It is possible to host LFS objects externally by setting a custom LFS url with `
Because GitLab verifies the existence of objects referenced by LFS pointers, push will fail when LFS is enabled for the project. Because GitLab verifies the existence of objects referenced by LFS pointers, push will fail when LFS is enabled for the project.
LFS can be disabled for a project by Owners and Masters using the [Project API](../../api/projects.md#edit-project). LFS can be disabled from the [Project settings](../../user/project/settings/index.md).
```bash
curl --request PUT \
--url https://example.com/api/v4/projects/<PROJECT_ID> \
--header 'Private-Token: <YOUR_PRIVATE_TOKEN>' \
--data 'lfs_enabled=false'
```
Note, `<PROJECT_ID>` can also be substituted with a [namespaced path](../../api/README.md#namespaced-path-encoding).
require 'rails_helper' require 'rails_helper'
describe 'Projects > Settings > LFS settings' do describe 'Projects > Settings > LFS settings' do
let(:admin) { create(:admin) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { create(:user) }
let(:role) { :master }
context 'LFS enabled setting' do context 'LFS enabled setting' do
before do before do
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true) allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
sign_in(admin) sign_in(user)
project.add_role(user, role)
end end
it 'displays the correct elements', :js do context 'for master' do
visit edit_project_path(project) let(:role) { :master }
expect(page).to have_content('Git Large File Storage') it 'displays the correct elements', :js do
expect(page).to have_selector('input[name="project[lfs_enabled]"] + button', visible: true) visit edit_project_path(project)
expect(page).to have_content('Git Large File Storage')
expect(page).to have_selector('input[name="project[lfs_enabled]"] + button', visible: true)
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment