Restrict project creation with a built-in template when built_in_project_templates_enabled setting disabled
To support https://gitlab.com/groups/gitlab-org/-/work_items/21356+, the backend should reject project creation when a built-in template is selected. ### Proposed Change Add a guard in `CreateFromTemplateService#validate_template!` that rejects built-in templates when the new setting is disabled: ```ruby def validate_template! if built_in_template && !::Gitlab::CurrentSettings.built_in_project_templates_enabled? project.errors.add(:template_name, _("Built-in project templates are disabled")) return false end return true if built_in_template || sample_data_template project.errors.add(:template_name, _("'%{template_name}' is unknown or invalid") % { template_name: template_name }) false end ``` The unsaved Project with errors is returned up through `CreateService` to the API layer, where `render_validation_error!(project)` serializes it as a 400 with a clear message.
issue