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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
17e2e536
Commit
17e2e536
authored
Jun 05, 2019
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new attribute to application settings
Add migration and setting
parent
0f66d1ff
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
0 deletions
+56
-0
app/views/admin/application_settings/_visibility_and_access.html.haml
...min/application_settings/_visibility_and_access.html.haml
+1
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
db/schema.rb
db/schema.rb
+1
-0
ee/app/controllers/ee/admin/application_settings_controller.rb
...p/controllers/ee/admin/application_settings_controller.rb
+4
-0
ee/app/models/ee/application_setting.rb
ee/app/models/ee/application_setting.rb
+1
-0
ee/app/models/license.rb
ee/app/models/license.rb
+1
-0
ee/app/views/admin/application_settings/_default_project_deletion_protection_setting.html.haml
...gs/_default_project_deletion_protection_setting.html.haml
+10
-0
ee/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb
...lt_project_deletion_protection_to_application_settings.rb
+20
-0
ee/lib/ee/api/settings.rb
ee/lib/ee/api/settings.rb
+4
-0
ee/spec/requests/api/settings_spec.rb
ee/spec/requests/api/settings_spec.rb
+7
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
No files found.
app/views/admin/application_settings/_visibility_and_access.html.haml
View file @
17e2e536
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
.form-group
.form-group
=
f
.
label
s_
(
'ProjectCreationLevel|Default project creation protection'
),
class:
'label-bold'
=
f
.
label
s_
(
'ProjectCreationLevel|Default project creation protection'
),
class:
'label-bold'
=
f
.
select
:default_project_creation
,
options_for_select
(
Gitlab
::
Access
.
project_creation_options
,
@application_setting
.
default_project_creation
),
{},
class:
'form-control'
=
f
.
select
:default_project_creation
,
options_for_select
(
Gitlab
::
Access
.
project_creation_options
,
@application_setting
.
default_project_creation
),
{},
class:
'form-control'
=
render_if_exists
'admin/application_settings/default_project_deletion_protection_setting'
,
form:
f
.form-group.visibility-level-setting
.form-group.visibility-level-setting
=
f
.
label
:default_project_visibility
,
class:
'label-bold'
=
f
.
label
:default_project_visibility
,
class:
'label-bold'
=
render
(
'shared/visibility_radios'
,
model_method: :default_project_visibility
,
form:
f
,
selected_level:
@application_setting
.
default_project_visibility
,
form_model:
Project
.
new
)
=
render
(
'shared/visibility_radios'
,
model_method: :default_project_visibility
,
form:
f
,
selected_level:
@application_setting
.
default_project_visibility
,
form_model:
Project
.
new
)
...
...
config/initializers/1_settings.rb
View file @
17e2e536
...
@@ -138,6 +138,7 @@ Settings['issues_tracker'] ||= {}
...
@@ -138,6 +138,7 @@ Settings['issues_tracker'] ||= {}
#
#
Settings
[
'gitlab'
]
||=
Settingslogic
.
new
({})
Settings
[
'gitlab'
]
||=
Settingslogic
.
new
({})
Settings
.
gitlab
[
'default_project_creation'
]
||=
::
Gitlab
::
Access
::
DEVELOPER_MAINTAINER_PROJECT_ACCESS
Settings
.
gitlab
[
'default_project_creation'
]
||=
::
Gitlab
::
Access
::
DEVELOPER_MAINTAINER_PROJECT_ACCESS
Settings
.
gitlab
[
'default_project_deletion_protection'
]
||=
false
Settings
.
gitlab
[
'default_projects_limit'
]
||=
100000
Settings
.
gitlab
[
'default_projects_limit'
]
||=
100000
Settings
.
gitlab
[
'default_branch_protection'
]
||=
2
Settings
.
gitlab
[
'default_branch_protection'
]
||=
2
Settings
.
gitlab
[
'default_can_create_group'
]
=
true
if
Settings
.
gitlab
[
'default_can_create_group'
].
nil?
Settings
.
gitlab
[
'default_can_create_group'
]
=
true
if
Settings
.
gitlab
[
'default_can_create_group'
].
nil?
...
...
db/schema.rb
View file @
17e2e536
...
@@ -226,6 +226,7 @@ ActiveRecord::Schema.define(version: 20190611161641) do
...
@@ -226,6 +226,7 @@ ActiveRecord::Schema.define(version: 20190611161641) do
t
.
text
"encrypted_lets_encrypt_private_key"
t
.
text
"encrypted_lets_encrypt_private_key"
t
.
text
"encrypted_lets_encrypt_private_key_iv"
t
.
text
"encrypted_lets_encrypt_private_key_iv"
t
.
boolean
"dns_rebinding_protection_enabled"
,
default:
true
,
null:
false
t
.
boolean
"dns_rebinding_protection_enabled"
,
default:
true
,
null:
false
t
.
boolean
"default_project_deletion_protection"
,
default:
false
,
null:
false
t
.
index
[
"custom_project_templates_group_id"
],
name:
"index_application_settings_on_custom_project_templates_group_id"
,
using: :btree
t
.
index
[
"custom_project_templates_group_id"
],
name:
"index_application_settings_on_custom_project_templates_group_id"
,
using: :btree
t
.
index
[
"file_template_project_id"
],
name:
"index_application_settings_on_file_template_project_id"
,
using: :btree
t
.
index
[
"file_template_project_id"
],
name:
"index_application_settings_on_file_template_project_id"
,
using: :btree
t
.
index
[
"usage_stats_set_by_user_id"
],
name:
"index_application_settings_on_usage_stats_set_by_user_id"
,
using: :btree
t
.
index
[
"usage_stats_set_by_user_id"
],
name:
"index_application_settings_on_usage_stats_set_by_user_id"
,
using: :btree
...
...
ee/app/controllers/ee/admin/application_settings_controller.rb
View file @
17e2e536
...
@@ -26,6 +26,10 @@ module EE
...
@@ -26,6 +26,10 @@ module EE
attrs
<<
:pseudonymizer_enabled
attrs
<<
:pseudonymizer_enabled
end
end
if
License
.
feature_available?
(
:default_project_deletion_protection
)
attrs
<<
:default_project_deletion_protection
end
attrs
attrs
end
end
end
end
...
...
ee/app/models/ee/application_setting.rb
View file @
17e2e536
...
@@ -75,6 +75,7 @@ module EE
...
@@ -75,6 +75,7 @@ module EE
def
defaults
def
defaults
super
.
merge
(
super
.
merge
(
allow_group_owners_to_manage_ldap:
true
,
allow_group_owners_to_manage_ldap:
true
,
default_project_deletion_protection:
false
,
elasticsearch_aws:
false
,
elasticsearch_aws:
false
,
elasticsearch_aws_region:
ENV
[
'ELASTIC_REGION'
]
||
'us-east-1'
,
elasticsearch_aws_region:
ENV
[
'ELASTIC_REGION'
]
||
'us-east-1'
,
elasticsearch_replicas:
1
,
elasticsearch_replicas:
1
,
...
...
ee/app/models/license.rb
View file @
17e2e536
...
@@ -69,6 +69,7 @@ class License < ApplicationRecord
...
@@ -69,6 +69,7 @@ class License < ApplicationRecord
reject_unsigned_commits
reject_unsigned_commits
commit_committer_check
commit_committer_check
ci_cd_projects
ci_cd_projects
default_project_deletion_protection
protected_environments
protected_environments
custom_project_templates
custom_project_templates
group_project_templates
group_project_templates
...
...
ee/app/views/admin/application_settings/_default_project_deletion_protection_setting.html.haml
0 → 100644
View file @
17e2e536
-
return
unless
License
.
feature_available?
(
:default_project_deletion_protection
)
-
f
=
local_assigns
.
fetch
(
:form
)
.form-group
=
f
.
label
s_
(
'ProjectCreationLevel|Default project deletion protection'
),
class:
'label-bold'
.form-check
=
f
.
check_box
:default_project_deletion_protection
,
class:
'form-check-input'
=
f
.
label
:default_project_deletion_protection
,
class:
'form-check-label'
do
=
_
(
'Only admins can delete project'
)
ee/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb
0 → 100644
View file @
17e2e536
# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddDefaultProjectDeletionProtectionToApplicationSettings
<
ActiveRecord
::
Migration
[
5.1
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_column_with_default
:application_settings
,
:default_project_deletion_protection
,
:boolean
,
default:
false
,
allow_null:
false
end
def
down
remove_column
:application_settings
,
:default_project_deletion_protection
end
end
ee/lib/ee/api/settings.rb
View file @
17e2e536
...
@@ -24,6 +24,10 @@ module EE
...
@@ -24,6 +24,10 @@ module EE
attrs
=
attrs
.
except
(
:file_template_project_id
)
attrs
=
attrs
.
except
(
:file_template_project_id
)
end
end
unless
::
License
.
feature_available?
(
:default_project_deletion_protection
)
attrs
=
attrs
.
except
(
:default_project_deletion_protection
)
end
attrs
attrs
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
ee/spec/requests/api/settings_spec.rb
View file @
17e2e536
...
@@ -142,6 +142,13 @@ describe API::Settings, 'EE Settings' do
...
@@ -142,6 +142,13 @@ describe API::Settings, 'EE Settings' do
it_behaves_like
'settings for licensed features'
it_behaves_like
'settings for licensed features'
end
end
context
'mirroring settings'
do
let
(
:settings
)
{
{
default_project_deletion_protection:
true
}
}
let
(
:feature
)
{
:default_project_deletion_protection
}
it_behaves_like
'settings for licensed features'
end
context
'custom file template project'
do
context
'custom file template project'
do
let
(
:settings
)
{
{
file_template_project_id:
project
.
id
}
}
let
(
:settings
)
{
{
file_template_project_id:
project
.
id
}
}
let
(
:feature
)
{
:custom_file_templates
}
let
(
:feature
)
{
:custom_file_templates
}
...
...
locale/gitlab.pot
View file @
17e2e536
...
@@ -9050,6 +9050,9 @@ msgstr ""
...
@@ -9050,6 +9050,9 @@ msgstr ""
msgid "Only admins"
msgid "Only admins"
msgstr ""
msgstr ""
msgid "Only admins can delete project"
msgstr ""
msgid "Only mirror protected branches"
msgid "Only mirror protected branches"
msgstr ""
msgstr ""
...
@@ -10208,6 +10211,9 @@ msgstr ""
...
@@ -10208,6 +10211,9 @@ msgstr ""
msgid "ProjectCreationLevel|Default project creation protection"
msgid "ProjectCreationLevel|Default project creation protection"
msgstr ""
msgstr ""
msgid "ProjectCreationLevel|Default project deletion protection"
msgstr ""
msgid "ProjectCreationLevel|Developers + Maintainers"
msgid "ProjectCreationLevel|Developers + Maintainers"
msgstr ""
msgstr ""
...
...
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