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
e962ffbc
Commit
e962ffbc
authored
Jun 28, 2019
by
Fabio Papa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make maintainers the default setting for creating subgroups
parent
d32ed929
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
app/models/group.rb
app/models/group.rb
+6
-4
spec/models/group_spec.rb
spec/models/group_spec.rb
+8
-0
No files found.
app/models/group.rb
View file @
e962ffbc
...
@@ -58,6 +58,8 @@ class Group < Namespace
...
@@ -58,6 +58,8 @@ class Group < Namespace
add_authentication_token_field
:runners_token
,
encrypted:
->
{
Feature
.
enabled?
(
:groups_tokens_optional_encryption
,
default_enabled:
true
)
?
:optional
:
:required
}
add_authentication_token_field
:runners_token
,
encrypted:
->
{
Feature
.
enabled?
(
:groups_tokens_optional_encryption
,
default_enabled:
true
)
?
:optional
:
:required
}
before_create
:default_subgroup_creation_level_to_maintainers
after_create
:post_create_hook
after_create
:post_create_hook
after_destroy
:post_destroy_hook
after_destroy
:post_destroy_hook
after_save
:update_two_factor_requirement
after_save
:update_two_factor_requirement
...
@@ -416,10 +418,6 @@ class Group < Namespace
...
@@ -416,10 +418,6 @@ class Group < Namespace
super
||
::
Gitlab
::
CurrentSettings
.
default_project_creation
super
||
::
Gitlab
::
CurrentSettings
.
default_project_creation
end
end
def
subgroup_creation_level
super
||
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
end
private
private
def
update_two_factor_requirement
def
update_two_factor_requirement
...
@@ -449,4 +447,8 @@ class Group < Namespace
...
@@ -449,4 +447,8 @@ class Group < Namespace
errors
.
add
(
:visibility_level
,
"
#{
visibility
}
is not allowed since there are sub-groups with higher visibility."
)
errors
.
add
(
:visibility_level
,
"
#{
visibility
}
is not allowed since there are sub-groups with higher visibility."
)
end
end
def
default_subgroup_creation_level_to_maintainers
self
.
subgroup_creation_level
=
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
end
end
end
spec/models/group_spec.rb
View file @
e962ffbc
...
@@ -994,4 +994,12 @@ describe Group do
...
@@ -994,4 +994,12 @@ describe Group do
expect
(
group
.
project_creation_level
).
to
eq
(
Gitlab
::
CurrentSettings
.
default_project_creation
)
expect
(
group
.
project_creation_level
).
to
eq
(
Gitlab
::
CurrentSettings
.
default_project_creation
)
end
end
end
end
describe
'subgroup_creation_level'
do
it
'defaults to maintainers'
do
group
=
create
(
:group
)
expect
(
group
.
subgroup_creation_level
).
to
eq
(
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
end
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