Commit 3716ab28 authored by Alan Paruszewski's avatar Alan Paruszewski

Translate strings in DAST related services

This change adds translations to strings introduced in DAST related
services.
parent 8ee53528
...@@ -8,13 +8,13 @@ module DastScannerProfiles ...@@ -8,13 +8,13 @@ module DastScannerProfiles
return unauthorized unless can_delete_scanner_profile? return unauthorized unless can_delete_scanner_profile?
dast_scanner_profile = find_dast_scanner_profile(id) dast_scanner_profile = find_dast_scanner_profile(id)
return ServiceResponse.error(message: "Scanner profile not found for given parameters") unless dast_scanner_profile return ServiceResponse.error(message: _('Scanner profile not found for given parameters')) unless dast_scanner_profile
return ServiceResponse.error(message: "Cannot delete #{dast_scanner_profile.name} referenced in security policy") if referenced_in_security_policy?(dast_scanner_profile) return ServiceResponse.error(message: _('Cannot delete %{profile_name} referenced in security policy') % { profile_name: dast_scanner_profile.name }) if referenced_in_security_policy?(dast_scanner_profile)
if dast_scanner_profile.destroy if dast_scanner_profile.destroy
ServiceResponse.success(payload: dast_scanner_profile) ServiceResponse.success(payload: dast_scanner_profile)
else else
ServiceResponse.error(message: 'Scanner profile failed to delete') ServiceResponse.error(message: _('Scanner profile failed to delete'))
end end
end end
......
...@@ -8,8 +8,8 @@ module DastScannerProfiles ...@@ -8,8 +8,8 @@ module DastScannerProfiles
return unauthorized unless can_update_scanner_profile? return unauthorized unless can_update_scanner_profile?
dast_scanner_profile = find_dast_scanner_profile(id) dast_scanner_profile = find_dast_scanner_profile(id)
return ServiceResponse.error(message: "Scanner profile not found for given parameters") unless dast_scanner_profile return ServiceResponse.error(message: _('Scanner profile not found for given parameters')) unless dast_scanner_profile
return ServiceResponse.error(message: "Cannot modify #{dast_scanner_profile.name} referenced in security policy") if referenced_in_security_policy?(dast_scanner_profile) return ServiceResponse.error(message: _('Cannot modify %{profile_name} referenced in security policy') % { profile_name: dast_scanner_profile.name }) if referenced_in_security_policy?(dast_scanner_profile)
update_args = { update_args = {
name: profile_name, name: profile_name,
......
...@@ -13,7 +13,7 @@ module DastSiteProfiles ...@@ -13,7 +13,7 @@ module DastSiteProfiles
attr_reader :dast_site_profile attr_reader :dast_site_profile
def execute(name:, target_url:, **params) def execute(name:, target_url:, **params)
return ServiceResponse.error(message: 'Insufficient permissions') unless allowed? return ServiceResponse.error(message: _('Insufficient permissions')) unless allowed?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
dast_site = DastSites::FindOrCreateService.new(project, current_user).execute!(url: target_url) dast_site = DastSites::FindOrCreateService.new(project, current_user).execute!(url: target_url)
......
...@@ -8,13 +8,13 @@ module DastSiteProfiles ...@@ -8,13 +8,13 @@ module DastSiteProfiles
return unauthorized unless can_delete_site_profile? return unauthorized unless can_delete_site_profile?
dast_site_profile = find_dast_site_profile(id) dast_site_profile = find_dast_site_profile(id)
return ServiceResponse.error(message: "Site profile not found for given parameters") unless dast_site_profile return ServiceResponse.error(message: _('Site profile not found for given parameters')) unless dast_site_profile
return ServiceResponse.error(message: "Cannot delete #{dast_site_profile.name} referenced in security policy") if referenced_in_security_policy?(dast_site_profile) return ServiceResponse.error(message: _('Cannot delete %{profile_name} referenced in security policy') % { profile_name: dast_site_profile.name }) if referenced_in_security_policy?(dast_site_profile)
if dast_site_profile.destroy if dast_site_profile.destroy
ServiceResponse.success(payload: dast_site_profile) ServiceResponse.success(payload: dast_site_profile)
else else
ServiceResponse.error(message: 'Site profile failed to delete') ServiceResponse.error(message: _('Site profile failed to delete'))
end end
end end
......
...@@ -13,11 +13,11 @@ module DastSiteProfiles ...@@ -13,11 +13,11 @@ module DastSiteProfiles
attr_reader :dast_site_profile attr_reader :dast_site_profile
def execute(id:, **params) def execute(id:, **params)
return ServiceResponse.error(message: 'Insufficient permissions') unless allowed? return ServiceResponse.error(message: _('Insufficient permissions')) unless allowed?
find_dast_site_profile!(id) find_dast_site_profile!(id)
return ServiceResponse.error(message: "Cannot modify #{dast_site_profile.name} referenced in security policy") if referenced_in_security_policy? return ServiceResponse.error(message: _('Cannot modify %{profile_name} referenced in security policy') % { profile_name: dast_site_profile.name }) if referenced_in_security_policy?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
if target_url = params.delete(:target_url) if target_url = params.delete(:target_url)
...@@ -36,7 +36,7 @@ module DastSiteProfiles ...@@ -36,7 +36,7 @@ module DastSiteProfiles
rescue Rollback => e rescue Rollback => e
ServiceResponse.error(message: e.errors) ServiceResponse.error(message: e.errors)
rescue ActiveRecord::RecordNotFound => e rescue ActiveRecord::RecordNotFound => e
ServiceResponse.error(message: "#{e.model} not found") ServiceResponse.error(message: _('%{model_name} not found') % { model_name: e.model })
rescue ActiveRecord::RecordInvalid => e rescue ActiveRecord::RecordInvalid => e
ServiceResponse.error(message: e.record.errors.full_messages) ServiceResponse.error(message: e.record.errors.full_messages)
end end
......
...@@ -694,6 +694,9 @@ msgstr "" ...@@ -694,6 +694,9 @@ msgstr ""
msgid "%{milliseconds}ms" msgid "%{milliseconds}ms"
msgstr "" msgstr ""
msgid "%{model_name} not found"
msgstr ""
msgid "%{mrText}, this issue will be closed automatically." msgid "%{mrText}, this issue will be closed automatically."
msgstr "" msgstr ""
...@@ -5783,6 +5786,9 @@ msgstr "" ...@@ -5783,6 +5786,9 @@ msgstr ""
msgid "Cannot create the abuse report. This user has been blocked." msgid "Cannot create the abuse report. This user has been blocked."
msgstr "" msgstr ""
msgid "Cannot delete %{profile_name} referenced in security policy"
msgstr ""
msgid "Cannot enable shared runners because parent group does not allow it" msgid "Cannot enable shared runners because parent group does not allow it"
msgstr "" msgstr ""
...@@ -5804,6 +5810,9 @@ msgstr "" ...@@ -5804,6 +5810,9 @@ msgstr ""
msgid "Cannot merge" msgid "Cannot merge"
msgstr "" msgstr ""
msgid "Cannot modify %{profile_name} referenced in security policy"
msgstr ""
msgid "Cannot modify managed Kubernetes cluster" msgid "Cannot modify managed Kubernetes cluster"
msgstr "" msgstr ""
...@@ -17104,6 +17113,9 @@ msgstr "" ...@@ -17104,6 +17113,9 @@ msgstr ""
msgid "Instance overview" msgid "Instance overview"
msgstr "" msgstr ""
msgid "Insufficient permissions"
msgstr ""
msgid "Integration" msgid "Integration"
msgstr "" msgstr ""
...@@ -27544,6 +27556,12 @@ msgstr "" ...@@ -27544,6 +27556,12 @@ msgstr ""
msgid "Scanner" msgid "Scanner"
msgstr "" msgstr ""
msgid "Scanner profile failed to delete"
msgstr ""
msgid "Scanner profile not found for given parameters"
msgstr ""
msgid "Schedule a new pipeline" msgid "Schedule a new pipeline"
msgstr "" msgstr ""
...@@ -29190,6 +29208,12 @@ msgstr "" ...@@ -29190,6 +29208,12 @@ msgstr ""
msgid "Single or combined queries" msgid "Single or combined queries"
msgstr "" msgstr ""
msgid "Site profile failed to delete"
msgstr ""
msgid "Site profile not found for given parameters"
msgstr ""
msgid "Size" msgid "Size"
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