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
WP 53330, user from LDAP has now disabled name and email in Profile
Richard "Virgo" Richter771abc92a109
diff --git a/app/models/permitted_params.rb b/app/models/permitted_params.rbindex 496f7f40961..68d61fe64b8 100644--- a/app/models/permitted_params.rb+++ b/app/models/permitted_params.rb@@ -187,8 +187,13 @@ class PermittedParamsenddef user(additional_params = [])- permitted_params = params.require(:user).permit(*self.class.permitted_attributes[:user] + additional_params)- permitted_params.merge(custom_field_values(:user))+ if params[:user].present?+ permitted_params = params.require(:user).permit(*self.class.permitted_attributes[:user] + additional_params)+ permitted_params.merge(custom_field_values(:user))+ else+ # This happens on the Profile page for LDAP user, no "user" hash is sent.+ {}.merge(custom_field_values(:user, required: false))+ endenddef placeholder_userdiff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erbindex ab609a78f43..8f89deeb540 100644--- a/app/views/my/account.html.erb+++ b/app/views/my/account.html.erb@@ -49,19 +49,31 @@ See COPYRIGHT and LICENSE files for more details.</div></div><% login_via_provider = [email protected]_url %>+ <% login_via_ldap = [email protected]_auth_source_id %><div class="form--field -required">- <%= f.text_field :firstname, required: true, container_class: '-middle', disabled: login_via_provider %>+ <%= f.text_field :firstname, required: true, container_class: '-middle', disabled: login_via_provider || login_via_ldap %><% if login_via_provider %><span class="form--field-instructions"><%= t('user.text_change_disabled_for_provider_login') %></span><% end %>+ <% if login_via_ldap %>+ <span class="form--field-instructions"><%= t('user.text_change_disabled_for_ldap_login') %></span>+ <% end %></div><div class="form--field -required">- <%= f.text_field :lastname, required: true, container_class: '-middle', disabled: login_via_provider %>+ <%= f.text_field :lastname, required: true, container_class: '-middle', disabled: login_via_provider || login_via_ldap %><% if login_via_provider %><span class="form--field-instructions"><%= t('user.text_change_disabled_for_provider_login') %></span><% end %>+ <% if login_via_ldap %>+ <span class="form--field-instructions"><%= t('user.text_change_disabled_for_ldap_login') %></span>+ <% end %>+ </div>+ <div class="form--field -required">+ <%= f.text_field :mail, required: true, container_class: '-middle', disabled: login_via_ldap %>+ <% if login_via_ldap %>+ <span class="form--field-instructions"><%= t('user.text_change_disabled_for_ldap_login') %></span>+ <% end %></div>- <div class="form--field -required"><%= f.text_field :mail, required: true, container_class: '-middle' %></div><%= fields_for :pref, @user.pref, builder: TabularFormBuilder, lang: current_language do |pref_fields| %><div class="form--field"><%= pref_fields.check_box :hide_mail %></div>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex eb59e3cd864..b762d51f9ca 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -3330,6 +3330,7 @@ en:status_user_and_brute_force: "%{user} and %{brute_force}"status_change: "Status change"text_change_disabled_for_provider_login: "The name is set by your login provider and can thus not be changed."+ text_change_disabled_for_ldap_login: "The name and email is set by LDAP and can thus not be changed."unlock: "Unlock"unlock_and_reset_failed_logins: "Unlock and reset failed logins"