Skip to content
代码片段 群组 项目
未验证 提交 60410ca9 编辑于 作者: Kos Palchyk's avatar Kos Palchyk 提交者: GitLab
浏览文件

Hides user checkbox that allows group creation

Changelog: changed
上级 4e151a53
No related branches found
No related tags found
无相关合并请求
......@@ -9,7 +9,8 @@
= f.number_field :projects_limit, min: 0, max: Gitlab::Database::MAX_INT_VALUE, class: 'form-control gl-form-input gl-form-input-sm'
.form-group.gl-form-group{ role: 'group' }
= f.gitlab_ui_checkbox_component :can_create_group, s_('AdminUsers|Can create top level group')
- if @user.allow_user_to_create_group_and_project?
= f.gitlab_ui_checkbox_component :can_create_group, s_('AdminUsers|Can create top level group')
= f.gitlab_ui_checkbox_component :private_profile, s_('AdminUsers|Private profile')
%fieldset.form-group.gl-form-group
......
......@@ -39,7 +39,7 @@
= f.label :password_confirmation, _('Password confirmation'), class: 'gl-display-block col-form-label'
= f.password_field :password_confirmation, disabled: f.object.force_random_password, autocomplete: 'new-password', class: 'form-control gl-form-input gl-form-input-lg'
= render partial: 'access_levels', locals: { f: f }
= render partial: 'access', locals: { f: f }
= render_if_exists 'admin/users/namespace_plan_fieldset', f: f
......
......@@ -74,7 +74,7 @@
%li
%span.light= _('Can create top level groups:')
%strong
= @user.can_create_group ? _('Yes') : _('No')
= @user.allow_user_to_create_group_and_project? && @user.can_create_group ? _('Yes') : _('No')
%li
%span.light= _('Private profile:')
%strong
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/users/_form.html.haml', feature_category: :user_management do
let_it_be(:user) { build(:user, :guest) }
before do
assign(:user, user)
end
describe 'Access' do
describe 'user top level group creation setting' do
context 'when the user is not allowed to create a group' do
before do
allow(user).to receive(:allow_user_to_create_group_and_project?).and_return(false)
end
it 'hides the checkbox' do
render
expect(rendered).not_to have_field(
'Can create top level group',
type: 'checkbox'
)
end
end
context 'when the user is allowed to create a group' do
before do
allow(user).to receive(:allow_user_to_create_group_and_project?).and_return(true)
end
it 'renders the checkbox' do
render
expect(rendered).to have_field(
'Can create top level group',
type: 'checkbox'
)
end
end
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册