Commit 564050ec authored by James Ramsay's avatar James Ramsay

Enable LFS setting UI for Masters and Owners

LFS can be enabled and disabled per project using the API by Masters
and Owners, but the UI is only available to Admins. The interface and
API should be consistent.

LFS can also be enabled and disabled per group using the API by Owners,
but the UI is only available to Admins. This interface should also be
consistent.

Additionally removes an unneeded check if 2FA interface, since the
interface is only available to Owners.

Closes #33320
parent 1134f540
...@@ -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
...@@ -11,8 +10,7 @@ ...@@ -11,8 +10,7 @@
%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
...@@ -21,7 +19,7 @@ ...@@ -21,7 +19,7 @@
%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'
......
---
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
context 'for master' do
let(:role) { :master }
it 'displays the correct elements', :js do it 'displays the correct elements', :js do
visit edit_project_path(project) visit edit_project_path(project)
...@@ -18,4 +23,5 @@ describe 'Projects > Settings > LFS settings' do ...@@ -18,4 +23,5 @@ describe 'Projects > Settings > LFS settings' do
expect(page).to have_selector('input[name="project[lfs_enabled]"] + button', visible: true) 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