Skip to content

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

Reintroduce sections, add one for mapping

Oliver Günther15490f22f15a
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 68e065616e0..67c686f7d8f 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2141,6 +2141,7 @@ en:
label_api_doc: "API documentation"
label_backup: "Backup"
label_backup_code: "Backup code"
+ label_basic_details: "Basic details"
label_between: "between"
label_blocked_by: "blocked by"
label_blocks: "blocks"
diff --git a/modules/openid_connect/app/components/openid_connect/providers/view_component.html.erb b/modules/openid_connect/app/components/openid_connect/providers/view_component.html.erb
index e6edcae4289..3291270d85f 100644
--- a/modules/openid_connect/app/components/openid_connect/providers/view_component.html.erb
+++ b/modules/openid_connect/app/components/openid_connect/providers/view_component.html.erb
@@ -9,6 +9,10 @@
<% end %>
<%= render(border_box_container) do |component|
+ component.with_header(color: :muted) do
+ render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t(:label_basic_details) }
+ end
+
case provider.oidc_provider
when 'google'
component.with_row(scheme: :default) do
@@ -99,10 +103,6 @@
end
end
else # custom
-# component.with_header(color: :muted) do
-# render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t('openid_connect.providers.label_basic_details') }
-# end
-
component.with_row(scheme: :default) do
basic_details_component =
if edit_state == :name
@@ -126,9 +126,9 @@
render(basic_details_component)
end
-# component.with_row(scheme: :neutral, color: :muted) do
-# render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t('openid_connect.providers.label_automatic_configuration') }
-# end
+ component.with_row(scheme: :neutral, color: :muted) do
+ render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t('openid_connect.providers.label_automatic_configuration') }
+ end
component.with_row(scheme: :default) do
if edit_state == :metadata
@@ -153,9 +153,9 @@
end
end
-# component.with_row(scheme: :neutral, color: :muted) do
-# render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t('openid_connect.providers.label_advanced_configuration') }
-# end
+ component.with_row(scheme: :neutral, color: :muted) do
+ render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t('openid_connect.providers.label_advanced_configuration') }
+ end
component.with_row(scheme: :default) do
if edit_state == :metadata_details
@@ -205,6 +205,10 @@
end
end
+ component.with_row(scheme: :neutral, color: :muted) do
+ render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t('openid_connect.providers.label_optional_configuration') }
+ end
+
component.with_row(scheme: :default) do
if edit_state == :attribute_mapping
render(ns::Sections::FormComponent.new(
@@ -221,8 +225,8 @@
view_mode:,
heading: t("openid_connect.providers.label_attribute_mapping"),
description: t("openid_connect.providers.section_texts.attribute_mapping"),
- label: provider.metadata_configured? ? t(:label_completed) : nil,
- label_scheme: provider.metadata_configured? ? :success : :secondary
+ label: provider.mapping_configured? ? t(:label_completed) : nil,
+ label_scheme: provider.mapping_configured? ? :success : :secondary
))
end
end
diff --git a/modules/openid_connect/app/models/openid_connect/provider.rb b/modules/openid_connect/app/models/openid_connect/provider.rb
index 06905634e29..d6faaed5d0c 100644
--- a/modules/openid_connect/app/models/openid_connect/provider.rb
+++ b/modules/openid_connect/app/models/openid_connect/provider.rb
@@ -49,6 +49,12 @@ module OpenIDConnect
end
end
+ def mapping_configured?
+ MAPPABLE_ATTRIBUTES.any? do |mandatory_attribute|
+ public_send(:"mapping_#{mandatory_attribute}").present?
+ end
+ end
+
def configured?
basic_details_configured? && advanced_details_configured? && metadata_configured?
end
diff --git a/modules/openid_connect/config/locales/en.yml b/modules/openid_connect/config/locales/en.yml
index 652bdf07f3e..4a7bfe91dab 100644
--- a/modules/openid_connect/config/locales/en.yml
+++ b/modules/openid_connect/config/locales/en.yml
@@ -70,9 +70,9 @@ en:
label_edit: Edit OpenID provider %{name}
label_empty_title: No OIDC providers configured yet.
label_empty_description: Add a provider to see them here.
- label_basic_details: Basic details
label_metadata: OpenID Connect Discovery Endpoint
label_automatic_configuration: Automatic configuration
+ label_optional_configuration: Optional configuration
label_advanced_configuration: Advanced configuration
label_configuration_details: Metadata
label_client_details: Client details