Project

General

Profile

Actions

Bug #4537

closed

Unsetting roles via API does not work

Added by Marek Hulán about 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When user tries to set empty array of role_ids, he receives

{
    "error": {
        "message": "undefined method `uniq' for nil:NilClass" 
    }
}
Started PUT "/foreman/api/users/13" for 127.0.0.1 at 2014-03-04 09:40:34 +0100
Processing by Api::V1::UsersController#update as JSON
  Parameters: {"user"=>{"login"=>"somelogin", "role_ids"=>nil}, "apiv"=>"v1", "id"=>"13"}
  User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1  [["id", 1]]
Setting current user thread-local variable to admin
  User Load (0.5ms)  SELECT "users".* FROM "users" WHERE "users"."login" = '13' ORDER BY firstname LIMIT 1
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 13 ORDER BY firstname LIMIT 1
   (0.2ms)  BEGIN
   (0.1ms)  ROLLBACK
undefined method `uniq' for nil:NilClass (NoMethodError)
/home/ares/Projekty/Zdrojaky/foreman/app/models/user.rb:272:in `role_ids_with_change_detection='
Actions #1

Updated by Marek Hulán about 10 years ago

  • Status changed from Assigned to Ready For Testing
  • translation missing: en.field_release set to 4
Actions #3

Updated by Marek Hulán about 10 years ago

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

Also available in: Atom PDF