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
Remove group_ids from users controller
Oliver Güntherb3096d38568c
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rbindex 265eb40696e..cf0e80e0ff5 100644--- a/app/controllers/users_controller.rb+++ b/app/controllers/users_controller.rb@@ -128,7 +128,7 @@ class UsersController < ApplicationControllerenddef update- @user.attributes = permitted_params.user_update_as_admin(@user.uses_external_authentication?,+ @user.attributes = permitted_params.user_create_as_admin(@user.uses_external_authentication?,@user.change_password_allowed?)if @user.change_password_allowed?diff --git a/app/models/permitted_params.rb b/app/models/permitted_params.rbindex 8fd848ff39b..ac445179789 100644--- a/app/models/permitted_params.rb+++ b/app/models/permitted_params.rb@@ -197,13 +197,6 @@ class PermittedParamspermitted_paramsend- def user_update_as_admin(external_authentication, change_password_allowed)- # Found group_ids in safe_attributes and added them here as I- # didn't know the consequences of removing these.- # They were not allowed on create.- user_create_as_admin(external_authentication, change_password_allowed, [group_ids: []])- end-def user_create_as_admin(external_authentication,change_password_allowed,additional_params = [])diff --git a/app/views/users/_groups.html.erb b/app/views/users/_groups.html.erbindex 59ec3c760f4..3fbe4289df8 100644--- a/app/views/users/_groups.html.erb+++ b/app/views/users/_groups.html.erb@@ -27,14 +27,12 @@ See docs/COPYRIGHT.rdoc for more details.++#%><%= labelled_tabular_form_for(:user, url: { action: 'update' }, html: {method: :put}) do %>+ <%= link_to t(:label_manage_groups), groups_path, class: 'button -highlight' %><section class="form--section"><% Group.all.sort.each do |group| %>- <label class="form--label-with-check-box">- <%= styled_check_box_tag 'user[group_ids][]', group.id, @user.groups.include?(group) %>- <%= group %>- </label>+ <ul>+ <li><%= link_to group.name, group_path(group) %></li>+ </ul><% end %>- <%= hidden_field_tag 'user[group_ids][]', '' %></section>- <%= styled_button_tag l(:button_save), class: '-highlight -with-icon icon-checkmark' %><% end %>diff --git a/spec_legacy/functional/users_controller_spec.rb b/spec_legacy/functional/users_controller_spec.rbindex 859e624bfe2..a4f7bda6731 100644--- a/spec_legacy/functional/users_controller_spec.rb+++ b/spec_legacy/functional/users_controller_spec.rb@@ -207,13 +207,6 @@ describe UsersController, type: :controller doassert_template 'edit'end- it 'should update with group ids should assign groups' do- put :update, params: { id: 2, user: { group_ids: ['10'] } }-- user = User.find(2)- assert_equal [10], user.group_ids- end-it 'should update with password change should send a notification' doSetting.bcc_recipients = '1'