Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/alert_management/http_integrations/update_service.rb')
-rw-r--r--app/services/alert_management/http_integrations/update_service.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/services/alert_management/http_integrations/update_service.rb b/app/services/alert_management/http_integrations/update_service.rb
index 220c4e759f0..af079f670b8 100644
--- a/app/services/alert_management/http_integrations/update_service.rb
+++ b/app/services/alert_management/http_integrations/update_service.rb
@@ -9,7 +9,7 @@ module AlertManagement
def initialize(integration, current_user, params)
@integration = integration
@current_user = current_user
- @params = params
+ @params = params.with_indifferent_access
end
def execute
@@ -17,7 +17,7 @@ module AlertManagement
params[:token] = nil if params.delete(:regenerate_token)
- if integration.update(params)
+ if integration.update(permitted_params)
success
else
error(integration.errors.full_messages.to_sentence)
@@ -32,6 +32,15 @@ module AlertManagement
current_user&.can?(:admin_operations, integration)
end
+ def permitted_params
+ params.slice(*permitted_params_keys)
+ end
+
+ # overriden in EE
+ def permitted_params_keys
+ %i[name active token]
+ end
+
def error(message)
ServiceResponse.error(message: message)
end
@@ -46,3 +55,5 @@ module AlertManagement
end
end
end
+
+::AlertManagement::HttpIntegrations::UpdateService.prepend_if_ee('::EE::AlertManagement::HttpIntegrations::UpdateService')