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

Allow disabling when seeded

Oliver Güntherb3cd44c4b94c
diff --git a/modules/auth_saml/app/components/saml/providers/sections/show_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/show_component.html.erb
index 0b381375eb9..a7f95321cb5 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/show_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/sections/show_component.html.erb
@@ -13,18 +13,19 @@
end
end
+ disabled = provider.seeded_from_env?
if show_edit?
grid.with_area(:action) do
flex_layout(justify_content: :flex_end) do |icons_container|
icons_container.with_column do
render(
Primer::Beta::IconButton.new(
- icon: :pencil,
+ icon: disabled ? :eye : :pencil,
tag: :a,
scheme: :invisible,
href: edit_saml_provider_path(provider, edit_state: @target_state),
data: { turbo: true, turbo_stream: true },
- aria: { label: I18n.t(:label_edit) }
+ aria: { label: I18n.t(disabled ? :label_show : :label_edit) }
)
)
end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/show_component.rb b/modules/auth_saml/app/components/saml/providers/sections/show_component.rb
index 434ebd19820..267a23282c8 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/show_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/sections/show_component.rb
@@ -43,8 +43,6 @@ module Saml::Providers::Sections
end
def show_edit?
- return false if provider.seeded_from_env?
-
provider.persisted? && @view_mode == :show
end
end
diff --git a/modules/auth_saml/app/forms/saml/providers/base_form.rb b/modules/auth_saml/app/forms/saml/providers/base_form.rb
index bea23db3abe..bcc7f7d5226 100644
--- a/modules/auth_saml/app/forms/saml/providers/base_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/base_form.rb
@@ -29,6 +29,8 @@
module Saml
module Providers
class BaseForm < ApplicationForm
+ attr_reader :provider
+
def initialize(provider:)
super()
@provider = provider
diff --git a/modules/auth_saml/app/forms/saml/providers/configuration_form.rb b/modules/auth_saml/app/forms/saml/providers/configuration_form.rb
index 3c09a776334..c917d3ec1c7 100644
--- a/modules/auth_saml/app/forms/saml/providers/configuration_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/configuration_form.rb
@@ -34,6 +34,7 @@ module Saml
name: :sp_entity_id,
label: I18n.t("activemodel.attributes.saml/provider.sp_entity_id"),
caption: I18n.t("saml.instructions.sp_entity_id"),
+ disabled: provider.seeded_from_env?,
required: true,
input_width: :large
)
@@ -41,6 +42,7 @@ module Saml
name: :idp_sso_service_url,
label: I18n.t("activemodel.attributes.saml/provider.idp_sso_service_url"),
caption: I18n.t("saml.instructions.idp_sso_service_url"),
+ disabled: provider.seeded_from_env?,
required: true,
input_width: :large
)
@@ -48,6 +50,7 @@ module Saml
name: :idp_slo_service_url,
label: I18n.t("activemodel.attributes.saml/provider.idp_slo_service_url"),
caption: I18n.t("saml.instructions.idp_slo_service_url"),
+ disabled: provider.seeded_from_env?,
required: false,
input_width: :large
)
@@ -56,6 +59,7 @@ module Saml
rows: 10,
label: I18n.t("activemodel.attributes.saml/provider.idp_cert"),
caption: I18n.t("saml.instructions.idp_cert"),
+ disabled: provider.seeded_from_env?,
required: true,
input_width: :large
)
@@ -63,6 +67,7 @@ module Saml
name: "name_identifier_format",
label: I18n.t("activemodel.attributes.saml/provider.name_identifier_format"),
input_width: :large,
+ disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.name_identifier_format")
) do |list|
Saml::Defaults::NAME_IDENTIFIER_FORMATS.each do |format|
@@ -73,6 +78,7 @@ module Saml
name: :limit_self_registration,
label: I18n.t("activemodel.attributes.saml/provider.limit_self_registration"),
caption: I18n.t("saml.instructions.limit_self_registration"),
+ disabled: provider.seeded_from_env?,
required: false,
input_width: :large
)
@@ -80,6 +86,7 @@ module Saml
name: :icon,
label: I18n.t("activemodel.attributes.saml/provider.icon"),
caption: I18n.t("saml.instructions.icon"),
+ disabled: provider.seeded_from_env?,
required: false,
input_width: :large
)
diff --git a/modules/auth_saml/app/forms/saml/providers/encryption_form.rb b/modules/auth_saml/app/forms/saml/providers/encryption_form.rb
index d86698612c1..6ca17831771 100644
--- a/modules/auth_saml/app/forms/saml/providers/encryption_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/encryption_form.rb
@@ -34,18 +34,21 @@ module Saml
name: :authn_requests_signed,
label: I18n.t("activemodel.attributes.saml/provider.authn_requests_signed"),
caption: I18n.t("saml.instructions.authn_requests_signed"),
+ disabled: provider.seeded_from_env?,
required: true
)
f.check_box(
name: :want_assertions_signed,
label: I18n.t("activemodel.attributes.saml/provider.want_assertions_signed"),
caption: I18n.t("saml.instructions.want_assertions_signed"),
+ disabled: provider.seeded_from_env?,
required: true
)
f.check_box(
name: :want_assertions_encrypted,
label: I18n.t("activemodel.attributes.saml/provider.want_assertions_encrypted"),
caption: I18n.t("saml.instructions.want_assertions_encrypted"),
+ disabled: provider.seeded_from_env?,
required: true
)
f.text_area(
@@ -54,6 +57,7 @@ module Saml
label: I18n.t("activemodel.attributes.saml/provider.certificate"),
caption: I18n.t("saml.instructions.certificate"),
required: false,
+ disabled: provider.seeded_from_env?,
input_width: :large
)
f.text_area(
@@ -62,12 +66,14 @@ module Saml
label: I18n.t("activemodel.attributes.saml/provider.private_key"),
caption: I18n.t("saml.instructions.private_key"),
required: false,
+ disabled: provider.seeded_from_env?,
input_width: :large
)
f.select_list(
name: :digest_method,
label: I18n.t("activemodel.attributes.saml/provider.digest_method"),
input_width: :large,
+ disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.digest_method", default_option: "SHA-1")
) do |list|
Saml::Defaults::DIGEST_METHODS.each do |label, value|
@@ -78,6 +84,7 @@ module Saml
name: :signature_method,
label: I18n.t("activemodel.attributes.saml/provider.signature_method"),
input_width: :large,
+ disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.signature_method", default_option: "RSA SHA-1")
) do |list|
Saml::Defaults::SIGNATURE_METHODS.each do |label, value|
diff --git a/modules/auth_saml/app/forms/saml/providers/mapping_form.rb b/modules/auth_saml/app/forms/saml/providers/mapping_form.rb
index 999a6a164bf..fa1be96a479 100644
--- a/modules/auth_saml/app/forms/saml/providers/mapping_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/mapping_form.rb
@@ -35,6 +35,7 @@ module Saml
label: I18n.t("saml.providers.label_mapping_for", attribute: User.human_attribute_name(:login)),
caption: I18n.t("saml.instructions.mapping_login"),
required: true,
+ disabled: provider.seeded_from_env?,
rows: 8,
input_width: :large
)
@@ -43,6 +44,7 @@ module Saml
label: I18n.t("saml.providers.label_mapping_for", attribute: User.human_attribute_name(:mail)),
caption: I18n.t("saml.instructions.mapping_mail"),
required: true,
+ disabled: provider.seeded_from_env?,
rows: 8,
input_width: :large
)
@@ -51,6 +53,7 @@ module Saml
label: I18n.t("saml.providers.label_mapping_for", attribute: User.human_attribute_name(:first_name)),
caption: I18n.t("saml.instructions.mapping_firstname"),
required: true,
+ disabled: provider.seeded_from_env?,
rows: 8,
input_width: :large
)
@@ -59,6 +62,7 @@ module Saml
label: I18n.t("saml.providers.label_mapping_for", attribute: User.human_attribute_name(:last_name)),
caption: I18n.t("saml.instructions.mapping_lastname"),
required: true,
+ disabled: provider.seeded_from_env?,
rows: 8,
input_width: :large
)
@@ -66,6 +70,7 @@ module Saml
name: :mapping_uid,
label: I18n.t("saml.providers.label_mapping_for", attribute: I18n.t("saml.providers.label_uid")),
caption: I18n.t("saml.instructions.mapping_uid"),
+ disabled: provider.seeded_from_env?,
rows: 8,
required: false,
input_width: :large
diff --git a/modules/auth_saml/app/forms/saml/providers/metadata_options_form.rb b/modules/auth_saml/app/forms/saml/providers/metadata_options_form.rb
index c27bb36ef2b..1b211010528 100644
--- a/modules/auth_saml/app/forms/saml/providers/metadata_options_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/metadata_options_form.rb
@@ -33,6 +33,7 @@ module Saml
f.radio_button_group(
name: "metadata",
scope_name_to_model: false,
+ disabled: provider.seeded_from_env?,
label: I18n.t("saml.providers.label_metadata")
) do |radio_group|
radio_group.radio_button(
@@ -40,6 +41,7 @@ module Saml
checked: [email protected]_metadata?,
label: I18n.t("saml.settings.metadata_none"),
caption: I18n.t("saml.instructions.metadata_none"),
+ disabled: provider.seeded_from_env?,
data: { "show-when-value-selected-target": "cause" }
)
@@ -48,6 +50,7 @@ module Saml
checked: @provider.metadata_url.present?,
label: I18n.t("saml.settings.metadata_url"),
caption: I18n.t("saml.instructions.metadata_url"),
+ disabled: provider.seeded_from_env?,
data: { "show-when-value-selected-target": "cause" }
)
@@ -56,6 +59,7 @@ module Saml
checked: @provider.metadata_xml.present?,
label: I18n.t("saml.settings.metadata_xml"),
caption: I18n.t("saml.instructions.metadata_xml"),
+ disabled: provider.seeded_from_env?,
data: { "show-when-value-selected-target": "cause" }
)
end
diff --git a/modules/auth_saml/app/forms/saml/providers/metadata_url_form.rb b/modules/auth_saml/app/forms/saml/providers/metadata_url_form.rb
index 4853f7f264d..bfa8bfd57bf 100644
--- a/modules/auth_saml/app/forms/saml/providers/metadata_url_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/metadata_url_form.rb
@@ -34,6 +34,7 @@ module Saml
name: :metadata_url,
label: I18n.t("saml.settings.metadata_url"),
required: false,
+ disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.metadata_url"),
input_width: :xlarge
)
diff --git a/modules/auth_saml/app/forms/saml/providers/metadata_xml_form.rb b/modules/auth_saml/app/forms/saml/providers/metadata_xml_form.rb
index 670a4d5f088..75039598aff 100644
--- a/modules/auth_saml/app/forms/saml/providers/metadata_xml_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/metadata_xml_form.rb
@@ -35,6 +35,7 @@ module Saml
label: I18n.t("saml.settings.metadata_xml"),
caption: I18n.t("saml.instructions.metadata_xml"),
required: false,
+ disabled: provider.seeded_from_env?,
full_width: false,
rows: 10,
input_width: :medium
diff --git a/modules/auth_saml/app/forms/saml/providers/name_input_form.rb b/modules/auth_saml/app/forms/saml/providers/name_input_form.rb
index 33e01879e72..4583f710e2c 100644
--- a/modules/auth_saml/app/forms/saml/providers/name_input_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/name_input_form.rb
@@ -34,6 +34,7 @@ module Saml
name: :display_name,
label: I18n.t("activemodel.attributes.saml/provider.display_name"),
required: true,
+ disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.display_name"),
input_width: :medium
)
diff --git a/modules/auth_saml/app/forms/saml/providers/request_attributes_form.rb b/modules/auth_saml/app/forms/saml/providers/request_attributes_form.rb
index 01882ff4c6c..e0b4cadcb9e 100644
--- a/modules/auth_saml/app/forms/saml/providers/request_attributes_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/request_attributes_form.rb
@@ -40,6 +40,7 @@ module Saml
name: :"requested_#{attribute}_attribute",
label: I18n.t("saml.providers.label_requested_attribute_for", attribute: label),
required: !uid,
+ disabled: provider.seeded_from_env?,
caption: uid ? I18n.t("saml.instructions.request_uid") : nil,
input_width: :large
)
@@ -48,6 +49,7 @@ module Saml
name: :"requested_#{attribute}_format",
label: I18n.t("activemodel.attributes.saml/provider.format"),
input_width: :large,
+ disabled: provider.seeded_from_env?,
caption: link_translate(
"saml.instructions.documentation_link",
links: {
diff --git a/modules/auth_saml/app/forms/saml/providers/submit_or_cancel_form.rb b/modules/auth_saml/app/forms/saml/providers/submit_or_cancel_form.rb
index d09139de777..ce4610581c6 100644
--- a/modules/auth_saml/app/forms/saml/providers/submit_or_cancel_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/submit_or_cancel_form.rb
@@ -39,7 +39,7 @@ module Saml
end
f.group(layout: :horizontal) do |button_group|
- button_group.submit(**@submit_button_options)
+ button_group.submit(**@submit_button_options) unless @provider.seeded_from_env?
button_group.button(**@cancel_button_options)
end
end
diff --git a/modules/costs/config/locales/en.yml b/modules/costs/config/locales/en.yml
index f8a7e05c2ad..a143a293300 100644
--- a/modules/costs/config/locales/en.yml
+++ b/modules/costs/config/locales/en.yml
@@ -125,6 +125,7 @@ en:
label_rate: "Rate"
label_rate_plural: "Rates"
label_status_finished: "Finished"
+ label_show: "Show"
label_units: "Cost units"
label_user: "User"
label_until: "until"