Project

General

Profile

Bug #14735

Cannot delete non admin user

Added by Brad Buckingham about 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Organizations and Locations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

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:

production.log production.log 27.4 KB production.log Mike McCune, 04/20/2016 02:59 PM

Related issues

Related to Foreman - Tracker #10022: Taxonomies related issuesNew2015-04-05

Associated revisions

Revision 5a3a7397 (diff)
Added by Marek Hulán about 4 years ago

Fixes #14735 - avoid double sweeping of User topbar cache

Revision ad9b709d (diff)
Added by Marek Hulán about 4 years ago

Fixes #14735 - avoid double sweeping of User topbar cache

(cherry picked from commit 5a3a73974c5dbc0f22e285e6786fe05df1452512)

History

#1 Updated by Dominic Cleal about 4 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)

#2 Updated by Mike McCune about 4 years ago

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.

#3 Updated by Dominic Cleal about 4 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.

#4 Updated by Marek Hulán about 4 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.

#5 Updated by The Foreman Bot about 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3468 added

#6 Updated by Marek Hulán about 4 years ago

#7 Updated by Marek Hulán about 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#8 Updated by Dominic Cleal about 4 years ago

  • Legacy Backlogs Release (now unused) set to 155

Also available in: Atom PDF