Bug #14735
closedCannot delete non admin user
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1314894
Description of problem:
When try to delete non admin user getting next error in UI
"Oops, we're sorry but something went wrong UserRole#expire_topbar_cache delegated to owner.expire_topbar_cache, but owner is nil: #<UserRole id: 478, owner_id: 376, role_id: 21, owner_type: "User">"
Version-Release number of selected component (if applicable):
6.2 SNAP 2.1
How reproducible:
Always
Steps to Reproduce:
1. Create new default user (non-admin)
2. Try to delete it
Actual results:
User is not deleted and exception is raised
Expected results:
User is deleted successfully
Additional info:
Files
Updated by Dominic Cleal over 8 years ago
- Category set to Web Interface
- Status changed from New to Need more information
I can't reproduce this, can you provide any more information? Is it only on 1.11.1 or on nightly? Does it happen with/without plugins? Does the user need to log in?
Logs would help, i.e.
2016-04-20 14:38:42 [app] [I] Started POST "/users" for 192.168.122.1 at 2016-04-20 14:38:42 +0000 2016-04-20 14:38:42 [app] [I] Processing by UsersController#create as */* 2016-04-20 14:38:42 [app] [I] Parameters: {"utf8"=>"✓", "authenticity_token"=>"eW3velkHNShIiKP7wkgMXF2Ggie/3FP8OGVzLtrQuWk=", "user"=>{"login"=>"testuser", "firstname"=>"test", "lastname"=>"user", "mail"=>"test@localhost", "locale"=>"", "timezone"=>"", "auth_source_id"=>"1", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "mail_enabled"=>"1", "admin"=>"0", "role_ids"=>[""]}} 2016-04-20 14:38:42 [app] [I] Expire fragment views/tabs_and_title_records-4 (0.1ms) 2016-04-20 14:38:42 [app] [I] Expire fragment views/tabs_and_title_records-4 (0.1ms) 2016-04-20 14:38:42 [app] [I] Redirected to https://foreman.example.com/users 2016-04-20 14:38:42 [app] [I] Completed 302 Found in 140ms (ActiveRecord: 54.6ms) 2016-04-20 14:38:42 [app] [I] Started GET "/users" for 192.168.122.1 at 2016-04-20 14:38:42 +0000 2016-04-20 14:38:42 [app] [I] Processing by UsersController#index as */* 2016-04-20 14:38:42 [app] [I] Rendered users/index.html.erb within layouts/application (10.2ms) 2016-04-20 14:38:42 [app] [I] Rendered common/_searchbar.html.erb (3.0ms) 2016-04-20 14:38:42 [app] [I] Rendered layouts/_application_content.html.erb (6.8ms) 2016-04-20 14:38:42 [app] [I] Rendered home/_user_dropdown.html.erb (1.6ms) 2016-04-20 14:38:42 [app] [I] Read fragment views/tabs_and_title_records-3 (0.2ms) 2016-04-20 14:38:42 [app] [I] Rendered home/_topbar.html.erb (6.2ms) 2016-04-20 14:38:42 [app] [I] Rendered layouts/base.html.erb (11.8ms) 2016-04-20 14:38:42 [app] [I] Completed 200 OK in 45ms (Views: 36.7ms | ActiveRecord: 2.4ms) 2016-04-20 14:38:50 [app] [I] Started DELETE "/users/4-testuser" for 192.168.122.1 at 2016-04-20 14:38:50 +0000 2016-04-20 14:38:50 [app] [I] Processing by UsersController#destroy as HTML 2016-04-20 14:38:50 [app] [I] Parameters: {"authenticity_token"=>"eW3velkHNShIiKP7wkgMXF2Ggie/3FP8OGVzLtrQuWk=", "id"=>"4-testuser"} 2016-04-20 14:38:50 [app] [I] Expire fragment views/tabs_and_title_records-4 (0.1ms) 2016-04-20 14:38:50 [app] [I] Expire fragment views/tabs_and_title_records-4 (0.1ms) 2016-04-20 14:38:50 [app] [I] Redirected to https://foreman.example.com/users 2016-04-20 14:38:50 [app] [I] Completed 302 Found in 61ms (ActiveRecord: 19.7ms)
Updated by Mike McCune over 8 years ago
- File production.log production.log added
attached logs from error condition.
This is on foreman-1.11.0.16-1.el7sat.noarch with plugins loaded and the user needs to be logged in.
A workaround is add the "Admin" flag to the user and then perform the delete.
Updated by Dominic Cleal over 8 years ago
I can't reproduce this, you'll need to debug it and provide the cause. UserRole should always be destroyed before the user, and assuming it is, then the association should not be nil. Perhaps the association isn't working.
Updated by Marek Hulán over 8 years ago
- Category changed from Web Interface to Organizations and Locations
- Status changed from Need more information to Assigned
- Assignee set to Marek Hulán
I reproduced on current develop branch. Just create user and try to delete him/her afterwards. The issue is caused by deleting mapping between taxonomies so when sweeper tried to find user_role owner it can't even though it still exists. So to reproduce, taxonomies must be enabled.
Updated by The Foreman Bot over 8 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3468 added
Updated by Marek Hulán over 8 years ago
- Related to Tracker #10022: Taxonomies related issues added
Updated by Marek Hulán over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 5a3a73974c5dbc0f22e285e6786fe05df1452512.
Updated by Dominic Cleal over 8 years ago
- Translation missing: en.field_release set to 155