OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Move attributes to base contract
Oliver Güntherb6e2450c706d
diff --git a/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.html.erbindex b2a6258a191..6717765444a 100644--- a/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.html.erb+++ b/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.html.erb@@ -1,7 +1,7 @@<%=primer_form_with(model: provider,- url: saml_provider_path(provider, state: :configuration),+ url: saml_provider_path(provider, state: :mapping),method: :put) do |form|flex_layout do |flex|diff --git a/modules/auth_saml/app/contracts/saml/providers/base_contract.rb b/modules/auth_saml/app/contracts/saml/providers/base_contract.rbindex 617876207b3..9d097ec4f4b 100644--- a/modules/auth_saml/app/contracts/saml/providers/base_contract.rb+++ b/modules/auth_saml/app/contracts/saml/providers/base_contract.rb@@ -36,6 +36,25 @@ module Samlattribute :display_nameattribute :options+ attribute :metadata_url+ validates :metadata_url,+ url: { allow_blank: true, allow_nil: true, schemes: %w[http https] },+ if: -> { model.metadata_url_changed? }++ attribute :idp_sso_service_url+ validates :idp_sso_service_url,+ url: { schemes: %w[http https] },+ if: -> { model.idp_sso_service_url_changed? }++ attribute :idp_slo_service_url+ validates :idp_slo_service_url,+ url: { schemes: %w[http https] },+ if: -> { model.idp_slo_service_url_changed? }++ %i[mapping_mail mapping_login mapping_firstname mapping_lastname].each do |attr|+ attribute attr+ validates_presence_of attr+ endendendenddiff --git a/modules/auth_saml/app/contracts/saml/providers/update_contract.rb b/modules/auth_saml/app/contracts/saml/providers/update_contract.rbindex 8d32027998b..44a17f81fea 100644--- a/modules/auth_saml/app/contracts/saml/providers/update_contract.rb+++ b/modules/auth_saml/app/contracts/saml/providers/update_contract.rb@@ -29,25 +29,6 @@module Samlmodule Providersclass UpdateContract < BaseContract- attribute :metadata_url- validates :metadata_url,- url: { allow_blank: true, allow_nil: true, schemes: %w[http https] },- if: -> { model.metadata_url_changed? }-- attribute :idp_sso_service_url- validates :idp_sso_service_url,- url: { schemes: %w[http https] },- if: -> { model.idp_sso_service_url_changed? }-- attribute :idp_slo_service_url- validates :idp_slo_service_url,- url: { schemes: %w[http https] },- if: -> { model.idp_slo_service_url_changed? }-- %i[mapping_mail mapping_login mapping_firstname mapping_lastname].each do |attr|- attribute attr- validates_presence_of attr- endendendenddiff --git a/modules/auth_saml/app/controllers/saml/providers_controller.rb b/modules/auth_saml/app/controllers/saml/providers_controller.rbindex dbeeaf9a95e..575cec37668 100644--- a/modules/auth_saml/app/controllers/saml/providers_controller.rb+++ b/modules/auth_saml/app/controllers/saml/providers_controller.rb@@ -155,7 +155,8 @@ module Samlparams.require(:saml_provider).permit(:display_name, :sp_entity_id, :idp_sso_service_url, :idp_slo_service_url, :idp_cert,- :name_identifier_format, :limit_self_registration)+ :name_identifier_format, :limit_self_registration,+ :mapping_login, :mapping_mail, :mapping_firstname, :mapping_lastname, :mapping_uid)enddef find_provider