Commit b5edb1c7 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'allow-changing-delayed-project-removal-instance-setting' into 'master'

Add instance setting for delayed project deletion

See merge request gitlab-org/gitlab!67230
parents 01587498 d2c9d626
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
= 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 = render_if_exists 'admin/application_settings/default_project_deletion_protection_setting', form: f
= render_if_exists 'admin/application_settings/default_delayed_project_deletion_setting', form: f
= render_if_exists 'admin/application_settings/default_project_deletion_adjourned_period_setting', form: f = render_if_exists 'admin/application_settings/default_project_deletion_adjourned_period_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'
......
...@@ -96,7 +96,7 @@ Example response: ...@@ -96,7 +96,7 @@ Example response:
``` ```
Users on GitLab [Premium or Ultimate](https://about.gitlab.com/pricing/) may also see Users on GitLab [Premium or Ultimate](https://about.gitlab.com/pricing/) may also see
the `file_template_project_id`, `deletion_adjourned_period`, or the `geo_node_allowed_ips` parameters: the `file_template_project_id`, `delayed_project_deletion`, `deletion_adjourned_period`, or the `geo_node_allowed_ips` parameters:
```json ```json
{ {
...@@ -104,6 +104,7 @@ the `file_template_project_id`, `deletion_adjourned_period`, or the `geo_node_al ...@@ -104,6 +104,7 @@ the `file_template_project_id`, `deletion_adjourned_period`, or the `geo_node_al
"signup_enabled" : true, "signup_enabled" : true,
"file_template_project_id": 1, "file_template_project_id": 1,
"geo_node_allowed_ips": "0.0.0.0/0, ::/0", "geo_node_allowed_ips": "0.0.0.0/0, ::/0",
"delayed_project_deletion": false,
"deletion_adjourned_period": 7, "deletion_adjourned_period": 7,
... ...
} }
...@@ -200,6 +201,7 @@ these parameters: ...@@ -200,6 +201,7 @@ these parameters:
- `file_template_project_id` - `file_template_project_id`
- `geo_node_allowed_ips` - `geo_node_allowed_ips`
- `geo_status_timeout` - `geo_status_timeout`
- `delayed_project_delection`
- `deletion_adjourned_period` - `deletion_adjourned_period`
Example responses: **(PREMIUM SELF)** Example responses: **(PREMIUM SELF)**
...@@ -250,6 +252,7 @@ listed in the descriptions of the relevant settings. ...@@ -250,6 +252,7 @@ listed in the descriptions of the relevant settings.
| `default_project_visibility` | string | no | What visibility level new projects receive. Can take `private`, `internal` and `public` as a parameter. Default is `private`. | | `default_project_visibility` | string | no | What visibility level new projects receive. Can take `private`, `internal` and `public` as a parameter. Default is `private`. |
| `default_projects_limit` | integer | no | Project limit per user. Default is `100000`. | | `default_projects_limit` | integer | no | Project limit per user. Default is `100000`. |
| `default_snippet_visibility` | string | no | What visibility level new snippets receive. Can take `private`, `internal` and `public` as a parameter. Default is `private`. | | `default_snippet_visibility` | string | no | What visibility level new snippets receive. Can take `private`, `internal` and `public` as a parameter. Default is `private`. |
| `delayed_project_deletion` | boolean | no | **(PREMIUM SELF)** Enable delayed project deletion by default in new groups. Default is `false`. |
| `deletion_adjourned_period` | integer | no | **(PREMIUM SELF)** The number of days to wait before deleting a project or group that is marked for deletion. Value must be between 0 and 90. | `deletion_adjourned_period` | integer | no | **(PREMIUM SELF)** The number of days to wait before deleting a project or group that is marked for deletion. Value must be between 0 and 90.
| `diff_max_patch_bytes` | integer | no | Maximum [diff patch size](../user/admin_area/diff_limits.md), in bytes. | | `diff_max_patch_bytes` | integer | no | Maximum [diff patch size](../user/admin_area/diff_limits.md), in bytes. |
| `diff_max_files` | integer | no | Maximum [files in a diff](../user/admin_area/diff_limits.md). | | `diff_max_files` | integer | no | Maximum [files in a diff](../user/admin_area/diff_limits.md). |
......
...@@ -71,6 +71,18 @@ To ensure only Administrator users can delete projects: ...@@ -71,6 +71,18 @@ To ensure only Administrator users can delete projects:
1. Check the **Default project deletion protection** checkbox. 1. Check the **Default project deletion protection** checkbox.
1. Click **Save changes**. 1. Click **Save changes**.
## Default delayed project deletion **(PREMIUM SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/255449) in GitLab 14.2.
Projects in a group (but not a personal namespace) can be deleted after a delayed period, by
[configuring in Group Settings](../../group/index.md#enable-delayed-project-removal).
To enable delayed project deletion by default in new groups:
1. Check the **Default delayed project deletion** checkbox.
1. Click **Save changes**.
## Default deletion delay **(PREMIUM SELF)** ## Default deletion delay **(PREMIUM SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32935) in GitLab 12.6. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32935) in GitLab 12.6.
......
...@@ -44,14 +44,14 @@ module EE ...@@ -44,14 +44,14 @@ module EE
custom_file_templates: :file_template_project_id, custom_file_templates: :file_template_project_id,
pseudonymizer: :pseudonymizer_enabled, pseudonymizer: :pseudonymizer_enabled,
default_project_deletion_protection: :default_project_deletion_protection, default_project_deletion_protection: :default_project_deletion_protection,
adjourned_deletion_for_projects_and_groups: :deletion_adjourned_period, adjourned_deletion_for_projects_and_groups: [:delayed_project_deletion, :deletion_adjourned_period],
required_ci_templates: :required_instance_ci_template, required_ci_templates: :required_instance_ci_template,
disable_name_update_for_users: :updating_name_disabled_for_users, disable_name_update_for_users: :updating_name_disabled_for_users,
package_forwarding: :npm_package_requests_forwarding, package_forwarding: :npm_package_requests_forwarding,
default_branch_protection_restriction_in_groups: :group_owners_can_manage_default_branch_protection default_branch_protection_restriction_in_groups: :group_owners_can_manage_default_branch_protection
}.each do |license_feature, attribute_name| }.each do |license_feature, attribute_names|
if License.feature_available?(license_feature) if License.feature_available?(license_feature)
attrs << attribute_name attrs += Array.wrap(attribute_names)
end end
end end
......
...@@ -115,6 +115,7 @@ module EE ...@@ -115,6 +115,7 @@ module EE
git_two_factor_session_expiry git_two_factor_session_expiry
group_owners_can_manage_default_branch_protection group_owners_can_manage_default_branch_protection
default_project_deletion_protection default_project_deletion_protection
delayed_project_deletion
deletion_adjourned_period deletion_adjourned_period
updating_name_disabled_for_users updating_name_disabled_for_users
npm_package_requests_forwarding npm_package_requests_forwarding
......
...@@ -116,6 +116,8 @@ module EE ...@@ -116,6 +116,8 @@ module EE
presence: true, presence: true,
numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: 10080 } numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: 10080 }
alias_attribute :delayed_project_deletion, :delayed_project_removal
after_commit :update_personal_access_tokens_lifetime, if: :saved_change_to_max_personal_access_token_lifetime? after_commit :update_personal_access_tokens_lifetime, if: :saved_change_to_max_personal_access_token_lifetime?
after_commit :resume_elasticsearch_indexing after_commit :resume_elasticsearch_indexing
end end
......
- return unless License.feature_available?(:adjourned_deletion_for_projects_and_groups)
- f = local_assigns.fetch(:form)
.form-group
= f.label s_('Default delayed project deletion'), class: 'label-bold'
.form-check
= f.check_box :delayed_project_deletion, class: 'form-check-input'
= f.label :delayed_project_deletion, class: 'form-check-label' do
= _('Enable delayed project deletion by default for newly-created groups.')
= _('Does not apply to projects in personal namespaces, which are deleted immediately on request.')
...@@ -7,4 +7,3 @@ ...@@ -7,4 +7,3 @@
= f.select :deletion_adjourned_period, options_for_select(0..90, @application_setting.deletion_adjourned_period), {}, class: 'form-control gl-form-input' = f.select :deletion_adjourned_period, options_for_select(0..90, @application_setting.deletion_adjourned_period), {}, class: 'form-control gl-form-input'
= f.label :deletion_adjourned_period, class: 'form-check-label' do = f.label :deletion_adjourned_period, class: 'form-check-label' do
= _('How many days need to pass between marking entity for deletion and actual removing it.') = _('How many days need to pass between marking entity for deletion and actual removing it.')
= _('Not applicable to personal namespaced projects, which are deleted immediately on request.')
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
setting_locked: setting_locked, setting_locked: setting_locked,
settings_path_helper: -> (locked_ancestor) { edit_group_path(locked_ancestor, anchor: 'js-permissions-settings') }, settings_path_helper: -> (locked_ancestor) { edit_group_path(locked_ancestor, anchor: 'js-permissions-settings') },
help_text: delayed_project_removal_help_text do help_text: delayed_project_removal_help_text do
= s_('GroupSettings|Enable delayed project removal') = s_('GroupSettings|Enable delayed project deletion')
= render 'shared/namespaces/cascading_settings/enforcement_checkbox', = render 'shared/namespaces/cascading_settings/enforcement_checkbox',
attribute: :delayed_project_removal, attribute: :delayed_project_removal,
group: group, group: group,
......
...@@ -16,6 +16,7 @@ module EE ...@@ -16,6 +16,7 @@ module EE
expose :email_additional_text, if: ->(_instance, _opts) { ::License.feature_available?(:email_additional_text) } expose :email_additional_text, if: ->(_instance, _opts) { ::License.feature_available?(:email_additional_text) }
expose :file_template_project_id, if: ->(_instance, _opts) { ::License.feature_available?(:custom_file_templates) } expose :file_template_project_id, if: ->(_instance, _opts) { ::License.feature_available?(:custom_file_templates) }
expose :default_project_deletion_protection, if: ->(_instance, _opts) { ::License.feature_available?(:default_project_deletion_protection) } expose :default_project_deletion_protection, if: ->(_instance, _opts) { ::License.feature_available?(:default_project_deletion_protection) }
expose :delayed_project_deletion, if: ->(_instance, _opts) { ::License.feature_available?(:adjourned_deletion_for_projects_and_groups) }
expose :deletion_adjourned_period, if: ->(_instance, _opts) { ::License.feature_available?(:adjourned_deletion_for_projects_and_groups) } expose :deletion_adjourned_period, if: ->(_instance, _opts) { ::License.feature_available?(:adjourned_deletion_for_projects_and_groups) }
expose :updating_name_disabled_for_users, if: ->(_instance, _opts) { ::License.feature_available?(:disable_name_update_for_users) } expose :updating_name_disabled_for_users, if: ->(_instance, _opts) { ::License.feature_available?(:disable_name_update_for_users) }
expose :npm_package_requests_forwarding, if: ->(_instance, _opts) { ::License.feature_available?(:package_forwarding) } expose :npm_package_requests_forwarding, if: ->(_instance, _opts) { ::License.feature_available?(:package_forwarding) }
......
...@@ -29,7 +29,7 @@ module EE ...@@ -29,7 +29,7 @@ module EE
end end
unless License.feature_available?(:adjourned_deletion_for_projects_and_groups) unless License.feature_available?(:adjourned_deletion_for_projects_and_groups)
attrs = attrs.except(:deletion_adjourned_period) attrs = attrs.except(:delayed_project_deletion, :deletion_adjourned_period)
end end
unless License.feature_available?(:disable_name_update_for_users) unless License.feature_available?(:disable_name_update_for_users)
......
...@@ -83,6 +83,13 @@ RSpec.describe Admin::ApplicationSettingsController do ...@@ -83,6 +83,13 @@ RSpec.describe Admin::ApplicationSettingsController do
it_behaves_like 'settings for licensed features' it_behaves_like 'settings for licensed features'
end end
context 'default delayed project deletion' do
let(:settings) { { delayed_project_deletion: true } }
let(:feature) { :adjourned_deletion_for_projects_and_groups }
it_behaves_like 'settings for licensed features'
end
context 'updating name disabled for users setting' do context 'updating name disabled for users setting' do
let(:settings) { { updating_name_disabled_for_users: true } } let(:settings) { { updating_name_disabled_for_users: true } }
let(:feature) { :disable_name_update_for_users } let(:feature) { :disable_name_update_for_users }
......
...@@ -187,6 +187,13 @@ RSpec.describe API::Settings, 'EE Settings' do ...@@ -187,6 +187,13 @@ RSpec.describe API::Settings, 'EE Settings' do
it_behaves_like 'settings for licensed features' it_behaves_like 'settings for licensed features'
end end
context 'delayed project deletion' do
let(:settings) { { delayed_project_deletion: true } }
let(:feature) { :adjourned_deletion_for_projects_and_groups }
it_behaves_like 'settings for licensed features'
end
context 'group_owners_can_manage_default_branch_protection setting' do context 'group_owners_can_manage_default_branch_protection setting' do
let(:settings) { { group_owners_can_manage_default_branch_protection: false } } let(:settings) { { group_owners_can_manage_default_branch_protection: false } }
let(:feature) { :default_branch_protection_restriction_in_groups } let(:feature) { :default_branch_protection_restriction_in_groups }
......
...@@ -10555,6 +10555,9 @@ msgstr "" ...@@ -10555,6 +10555,9 @@ msgstr ""
msgid "Default classification label" msgid "Default classification label"
msgstr "" msgstr ""
msgid "Default delayed project deletion"
msgstr ""
msgid "Default deletion delay" msgid "Default deletion delay"
msgstr "" msgstr ""
...@@ -11735,6 +11738,9 @@ msgstr "" ...@@ -11735,6 +11738,9 @@ msgstr ""
msgid "Documents reindexed: %{processed_documents} (%{percentage}%%)" msgid "Documents reindexed: %{processed_documents} (%{percentage}%%)"
msgstr "" msgstr ""
msgid "Does not apply to projects in personal namespaces, which are deleted immediately on request."
msgstr ""
msgid "Domain" msgid "Domain"
msgstr "" msgstr ""
...@@ -12260,6 +12266,9 @@ msgstr "" ...@@ -12260,6 +12266,9 @@ msgstr ""
msgid "Enable container expiration and retention policies for projects created earlier than GitLab 12.7." msgid "Enable container expiration and retention policies for projects created earlier than GitLab 12.7."
msgstr "" msgstr ""
msgid "Enable delayed project deletion by default for newly-created groups."
msgstr ""
msgid "Enable error tracking" msgid "Enable error tracking"
msgstr "" msgstr ""
...@@ -15944,7 +15953,7 @@ msgstr "" ...@@ -15944,7 +15953,7 @@ msgstr ""
msgid "GroupSettings|Disable group mentions" msgid "GroupSettings|Disable group mentions"
msgstr "" msgstr ""
msgid "GroupSettings|Enable delayed project removal" msgid "GroupSettings|Enable delayed project deletion"
msgstr "" msgstr ""
msgid "GroupSettings|Export group" msgid "GroupSettings|Export group"
...@@ -22577,9 +22586,6 @@ msgstr "" ...@@ -22577,9 +22586,6 @@ msgstr ""
msgid "Not all data has been processed yet, the accuracy of the chart for the selected timeframe is limited." msgid "Not all data has been processed yet, the accuracy of the chart for the selected timeframe is limited."
msgstr "" msgstr ""
msgid "Not applicable to personal namespaced projects, which are deleted immediately on request."
msgstr ""
msgid "Not available" msgid "Not available"
msgstr "" msgstr ""
......
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