Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
d4c53e17
Commit
d4c53e17
authored
Jul 01, 2019
by
Fabio Papa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply changes recomended by merge request coach
parent
b36d78ea
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
26 deletions
+29
-26
app/models/group.rb
app/models/group.rb
+4
-0
app/views/groups/_group_admin_settings.html.haml
app/views/groups/_group_admin_settings.html.haml
+6
-0
db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
.../20190626175626_add_group_creation_level_to_namespaces.rb
+5
-10
db/schema.rb
db/schema.rb
+1
-1
spec/controllers/admin/groups_controller_spec.rb
spec/controllers/admin/groups_controller_spec.rb
+2
-4
spec/features/admin/admin_groups_spec.rb
spec/features/admin/admin_groups_spec.rb
+9
-0
spec/features/groups/show_spec.rb
spec/features/groups/show_spec.rb
+2
-2
spec/services/groups/create_service_spec.rb
spec/services/groups/create_service_spec.rb
+0
-9
No files found.
app/models/group.rb
View file @
d4c53e17
...
...
@@ -416,6 +416,10 @@ class Group < Namespace
super
||
::
Gitlab
::
CurrentSettings
.
default_project_creation
end
def
subgroup_creation_level
super
||
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
end
private
def
update_two_factor_requirement
...
...
app/views/groups/_group_admin_settings.html.haml
View file @
d4c53e17
...
...
@@ -16,6 +16,12 @@
.col-sm-10
=
f
.
select
:project_creation_level
,
options_for_select
(
::
Gitlab
::
Access
.
project_creation_options
,
@group
.
project_creation_level
),
{},
class:
'form-control'
.form-group.row
.col-sm-2.col-form-label
=
f
.
label
s_
(
'SubgroupCreationlevel|Allowed to create subgroups'
)
.col-sm-10
=
f
.
select
:subgroup_creation_level
,
options_for_select
(
::
Gitlab
::
Access
.
subgroup_creation_options
,
@group
.
subgroup_creation_level
),
{},
class:
'form-control'
.form-group.row
.col-sm-2.col-form-label.pt-0
=
f
.
label
:require_two_factor_authentication
,
'Two-factor authentication'
...
...
db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
View file @
d4c53e17
...
...
@@ -7,18 +7,13 @@ class AddGroupCreationLevelToNamespaces < ActiveRecord::Migration[5.1]
disable_ddl_transaction!
def
up
unless
column_exists?
(
:namespaces
,
:subgroup_creation_level
)
add_column_with_default
(
:namespaces
,
:subgroup_creation_level
,
:integer
,
default:
0
)
change_column_default
(
:namespaces
,
:subgroup_creation_level
,
1
)
end
add_column
(
:namespaces
,
:subgroup_creation_level
,
:integer
)
change_column_default
(
:namespaces
,
:subgroup_creation_level
,
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
end
def
down
if
column_exists?
(
:namespaces
,
:subgroup_creation_level
)
remove_column
(
:namespaces
,
:subgroup_creation_level
)
end
remove_column
(
:namespaces
,
:subgroup_creation_level
)
end
end
db/schema.rb
View file @
d4c53e17
...
...
@@ -2119,7 +2119,7 @@ ActiveRecord::Schema.define(version: 2019_07_15_114644) do
t
.
string
"ldap_sync_status"
,
default:
"ready"
,
null:
false
t
.
boolean
"membership_lock"
,
default:
false
t
.
integer
"last_ci_minutes_usage_notification_level"
t
.
integer
"subgroup_creation_level"
,
default:
0
,
null:
false
t
.
integer
"subgroup_creation_level"
,
default:
1
t
.
index
[
"created_at"
],
name:
"index_namespaces_on_created_at"
,
using: :btree
t
.
index
[
"custom_project_templates_group_id"
,
"type"
],
name:
"index_namespaces_on_custom_project_templates_group_id_and_type"
,
where:
"(custom_project_templates_group_id IS NOT NULL)"
,
using: :btree
t
.
index
[
"file_template_project_id"
],
name:
"index_namespaces_on_file_template_project_id"
,
using: :btree
...
...
spec/controllers/admin/groups_controller_spec.rb
View file @
d4c53e17
...
...
@@ -70,13 +70,11 @@ describe Admin::GroupsController do
end
it
'updates the subgroup_creation_level successfully'
do
OWNER
=
::
Gitlab
::
Access
::
OWNER_SUBGROUP_ACCESS
expect
do
post
:update
,
params:
{
id:
group
.
to_param
,
group:
{
subgroup_creation_level:
OWNER
}
}
end
.
to
change
{
group
.
reload
.
subgroup_creation_level
}.
to
(
OWNER
)
group:
{
subgroup_creation_level:
::
Gitlab
::
Access
::
OWNER_SUBGROUP_ACCESS
}
}
end
.
to
change
{
group
.
reload
.
subgroup_creation_level
}.
to
(
::
Gitlab
::
Access
::
OWNER_SUBGROUP_ACCESS
)
end
end
end
spec/features/admin/admin_groups_spec.rb
View file @
d4c53e17
...
...
@@ -102,6 +102,15 @@ describe 'Admin Groups' do
expect_selected_visibility
(
group
.
visibility_level
)
end
it
'shows the subgroup creation level dropdown populated with the group subgroup_creation_level value'
do
group
=
create
(
:group
,
:private
,
:owner_subgroup_creation_only
)
visit
admin_group_edit_path
(
group
)
expect
(
page
).
to
have_select
(
"group_subgroup_creation_level"
,
selected:
::
Gitlab
::
Access
.
subgroup_creation_options
.
keys
[
group
.
subgroup_creation_level
])
end
it
'edit group path does not change group name'
,
:js
do
group
=
create
(
:group
,
:private
)
...
...
spec/features/groups/show_spec.rb
View file @
d4c53e17
...
...
@@ -71,7 +71,7 @@ describe 'Group show page' do
sign_in
(
owner
)
end
context
'when subgroups are supported'
,
:
js
,
:
nested_groups
do
context
'when subgroups are supported'
,
:nested_groups
do
before
do
allow
(
Group
).
to
receive
(
:supports_nested_objects?
)
{
true
}
visit
path
...
...
@@ -101,7 +101,7 @@ describe 'Group show page' do
sign_in
(
maintainer
)
end
context
'when subgroups are supported'
,
:
js
,
:
nested_groups
do
context
'when subgroups are supported'
,
:nested_groups
do
before
do
allow
(
Group
).
to
receive
(
:supports_nested_objects?
)
{
true
}
end
...
...
spec/services/groups/create_service_spec.rb
View file @
d4c53e17
# coding: utf-8
# frozen_string_literal: true
require
'spec_helper'
...
...
@@ -88,14 +87,6 @@ describe Groups::CreateService, '#execute' do
it
{
is_expected
.
to
be_persisted
}
end
context
'as maintainer'
do
before
do
group
.
add_maintainer
(
user
)
end
it
{
is_expected
.
to
be_persisted
}
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment