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

Rename edit_mode to new_mode for SAML as well

Jan Sandbrinkb44bf0dd9661
diff --git a/modules/auth_saml/app/components/saml/providers/sections/form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/form_component.html.erb
index 6fc154552fc..325bb35243c 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/form_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/sections/form_component.html.erb
@@ -33,7 +33,7 @@
form,
provider:,
submit_button_options: { label: button_label },
- cancel_button_options: { hidden: edit_mode }
+ cancel_button_options: { hidden: new_mode }
)
)
end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/form_component.rb
index e41841eb531..df3b92dbaa8 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/form_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/sections/form_component.rb
@@ -30,16 +30,16 @@
#
module Saml::Providers::Sections
class FormComponent < SectionComponent
- attr_reader :edit_state, :next_edit_state, :edit_mode
+ attr_reader :edit_state, :next_edit_state, :new_mode
def initialize(provider, edit_state:, form_class:,
heading:, banner: nil, banner_scheme: :default,
- next_edit_state: nil, edit_mode: nil)
+ next_edit_state: nil, new_mode: nil)
super(provider)
@edit_state = edit_state
@next_edit_state = next_edit_state
- @edit_mode = edit_mode
+ @new_mode = new_mode
@form_class = form_class
@heading = heading
@banner = banner
@@ -48,9 +48,9 @@ module Saml::Providers::Sections
def url
if provider.new_record?
- saml_providers_path(edit_state:, edit_mode:, next_edit_state:)
+ saml_providers_path(edit_state:, new_mode:, next_edit_state:)
else
- saml_provider_path(provider, edit_state:, edit_mode:, next_edit_state:)
+ saml_provider_path(provider, edit_state:, new_mode:, next_edit_state:)
end
end
@@ -63,7 +63,7 @@ module Saml::Providers::Sections
end
def button_label
- if edit_mode
+ if new_mode
I18n.t(:button_continue)
else
I18n.t(:button_update)
diff --git a/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.html.erb
index 3f15083be5e..e678f1d09ea 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.html.erb
@@ -2,14 +2,14 @@
primer_form_with(
model: provider,
id: "saml-providers-edit-form",
- url: import_metadata_saml_provider_path(provider, edit_mode:),
+ url: import_metadata_saml_provider_path(provider, new_mode:),
data: {
controller: "show-when-value-selected"
},
method: :post
) do |form|
flex_layout do |flex|
- if edit_mode
+ if new_mode
flex.with_row do
render(Primer::Beta::Text.new(tag: :p, mb: 4, font_size: :small)) do
t("saml.providers.section_texts.metadata_form")
@@ -49,7 +49,7 @@
form,
provider:,
submit_button_options: { label: button_label },
- cancel_button_options: { hidden: edit_mode },
+ cancel_button_options: { hidden: new_mode },
state: :metadata
)
)
diff --git a/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.rb
index 0572a5ea3be..9ad9793296b 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.rb
@@ -30,8 +30,8 @@
#
module Saml::Providers::Sections
class MetadataFormComponent < FormComponent
- def initialize(provider, edit_mode: nil)
- super(provider, edit_state: :metadata, edit_mode:, form_class: nil, heading: nil)
+ def initialize(provider, new_mode: nil)
+ super(provider, edit_state: :metadata, new_mode:, form_class: nil, heading: nil)
end
end
end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb
index 7e18f5ca67b..cdb7ccd69e5 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb
@@ -30,16 +30,16 @@
#
module Saml::Providers::Sections
class RequestAttributesFormComponent < FormComponent
- def initialize(provider, edit_mode: nil)
+ def initialize(provider, new_mode: nil)
super(provider,
edit_state: :requested_attributes,
- edit_mode:,
+ new_mode:,
form_class: Saml::Providers::RequestAttributesForm,
heading: I18n.t("saml.instructions.requested_attributes"))
end
def button_label
- if edit_mode
+ if new_mode
I18n.t(:button_finish_setup)
else
I18n.t(:button_save)
diff --git a/modules/auth_saml/app/components/saml/providers/view_component.html.erb b/modules/auth_saml/app/components/saml/providers/view_component.html.erb
index 41e85061c95..cc9a1bcf251 100644
--- a/modules/auth_saml/app/components/saml/providers/view_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/view_component.html.erb
@@ -20,7 +20,7 @@
form_class: Saml::Providers::NameInputForm,
edit_state:,
next_edit_state: :metadata,
- edit_mode:,
+ new_mode:,
heading: nil
)
)
@@ -46,7 +46,7 @@
render(
Saml::Providers::Sections::MetadataFormComponent.new(
provider,
- edit_mode:
+ new_mode:
)
)
else
@@ -76,7 +76,7 @@
form_class: Saml::Providers::ConfigurationForm,
edit_state:,
next_edit_state: :encryption,
- edit_mode:,
+ new_mode:,
banner: provider.last_metadata_update ? t("saml.providers.section_texts.configuration_metadata") : nil,
banner_scheme: :default,
heading: nil
@@ -104,7 +104,7 @@
form_class: Saml::Providers::EncryptionForm,
edit_state:,
next_edit_state: :mapping,
- edit_mode:,
+ new_mode:,
heading: t("saml.providers.section_texts.encryption_form")
)
)
@@ -133,7 +133,7 @@
form_class: Saml::Providers::MappingForm,
edit_state:,
next_edit_state: :requested_attributes,
- edit_mode:,
+ new_mode:,
heading: t("saml.instructions.mapping")
)
)
@@ -156,7 +156,7 @@
render(
Saml::Providers::Sections::RequestAttributesFormComponent.new(
provider,
- edit_mode:
+ new_mode:
)
)
else
diff --git a/modules/auth_saml/app/components/saml/providers/view_component.rb b/modules/auth_saml/app/components/saml/providers/view_component.rb
index d01b1d0b6cd..fd9402cb7a8 100644
--- a/modules/auth_saml/app/components/saml/providers/view_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/view_component.rb
@@ -33,7 +33,7 @@ module Saml::Providers
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
- options :view_mode, :edit_state, :edit_mode
+ options :view_mode, :edit_state, :new_mode
alias_method :provider, :model
end
diff --git a/modules/auth_saml/app/controllers/saml/providers_controller.rb b/modules/auth_saml/app/controllers/saml/providers_controller.rb
index 601d6467016..de4ce849f67 100644
--- a/modules/auth_saml/app/controllers/saml/providers_controller.rb
+++ b/modules/auth_saml/app/controllers/saml/providers_controller.rb
@@ -22,7 +22,7 @@ module Saml
format.turbo_stream do
component = Saml::Providers::ViewComponent.new(@provider,
view_mode: :edit,
- edit_mode: @edit_mode,
+ new_mode: @new_mode,
edit_state: @edit_state)
update_via_turbo_stream(component:)
scroll_into_view_via_turbo_stream("saml-providers-edit-form", behavior: :instant)
@@ -53,10 +53,10 @@ module Saml
@provider = call.result
if call.success?
- if @edit_mode || @provider.last_metadata_update.present?
+ if @new_mode || @provider.last_metadata_update.present?
redirect_to edit_saml_provider_path(@provider,
anchor: "saml-providers-edit-form",
- edit_mode: @edit_mode,
+ new_mode: @new_mode,
edit_state: :configuration)
else
redirect_to saml_provider_path(@provider)
@@ -90,7 +90,7 @@ module Saml
.call(update_params)
if call.success?
- flash[:notice] = I18n.t(:notice_successful_update) unless @edit_mode
+ flash[:notice] = I18n.t(:notice_successful_update) unless @new_mode
successful_save_response
else
@provider = call.result
@@ -122,7 +122,7 @@ module Saml
update_via_turbo_stream(
component: Saml::Providers::ViewComponent.new(
@provider,
- edit_mode: @edit_mode,
+ new_mode: @new_mode,
edit_state: @next_edit_state,
view_mode: :show
)
@@ -130,10 +130,10 @@ module Saml
render turbo_stream: turbo_streams
end
format.html do
- if @edit_mode && @next_edit_state
+ if @new_mode && @next_edit_state
redirect_to edit_saml_provider_path(@provider,
anchor: "saml-providers-edit-form",
- edit_mode: true,
+ new_mode: @new_mode,
edit_state: @next_edit_state)
else
redirect_to saml_provider_path(@provider)
@@ -187,7 +187,7 @@ module Saml
def set_edit_state
@edit_state = params[:edit_state].to_sym if params.key?(:edit_state)
- @edit_mode = ActiveRecord::Type::Boolean.new.cast(params[:edit_mode])
+ @new_mode = ActiveRecord::Type::Boolean.new.cast(params[:new_mode])
@next_edit_state = params[:next_edit_state].to_sym if params.key?(:next_edit_state)
end
end
diff --git a/modules/auth_saml/app/views/saml/providers/edit.html.erb b/modules/auth_saml/app/views/saml/providers/edit.html.erb
index c00e87fdeb6..07c32522ba0 100644
--- a/modules/auth_saml/app/views/saml/providers/edit.html.erb
+++ b/modules/auth_saml/app/views/saml/providers/edit.html.erb
@@ -26,7 +26,7 @@
Saml::Providers::ViewComponent.new(
@provider,
view_mode: :edit,
- edit_mode: @edit_mode,
+ new_mode: @new_mode,
edit_state: @edit_state
)
) %>
diff --git a/modules/auth_saml/app/views/saml/providers/new.html.erb b/modules/auth_saml/app/views/saml/providers/new.html.erb
index 1b0186468a3..58b9fb42d02 100644
--- a/modules/auth_saml/app/views/saml/providers/new.html.erb
+++ b/modules/auth_saml/app/views/saml/providers/new.html.erb
@@ -20,4 +20,4 @@
<% end %>
<% end %>
-<%= render(Saml::Providers::ViewComponent.new(@provider, edit_mode: true, edit_state: :name)) %>
+<%= render(Saml::Providers::ViewComponent.new(@provider, new_mode: true, edit_state: :name)) %>
diff --git a/modules/auth_saml/config/locales/en.yml b/modules/auth_saml/config/locales/en.yml
index ce8b8eac5ca..a9d7ea30559 100644
--- a/modules/auth_saml/config/locales/en.yml
+++ b/modules/auth_saml/config/locales/en.yml
@@ -54,15 +54,16 @@ en:
label_edit: Edit SAML identity provider %{name}
label_uid: Internal user id
label_mapping: Mapping
-
label_requested_attribute_for: "Requested attribute for: %{attribute}"
+
no_results_table: No SAML identity providers have been defined yet.
+ notice_created: A new SAML identity provider was successfully created.
plural: SAML identity providers
singular: SAML identity provider
requested_attributes: Requested attributes
attribute_mapping: Attribute mapping
attribute_mapping_text: >
- The following fields control which attributes provided by the SAML identity provider
+ The following fields control which attributes provided by the SAML identity provider
are used to provide user attributes in OpenProject
metadata:
dialog: "This is the URL where the OpenProject SAML metadata is available. Optionally use it to configure your identity provider:"
@@ -71,7 +72,7 @@ en:
description: Connect OpenProject to a SAML identity provider
request_attributes:
title: 'Requested attributes'
- legend: >
+ legend: >
These attributes are added to the SAML XML metadata to signify to the identify provider which attributes OpenProject requires.
You may still need to explicitly configure your identity provider to send these attributes. Please refer to your IdP's documentation.
name: 'Requested attribute key'