Bug 1549086 - internal server error ActiveRecord::AssociationTypeMismatch when editing current_group
Summary: internal server error ActiveRecord::AssociationTypeMismatch when editing curr...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.10.0
Assignee: Gregg Tanzillo
QA Contact: Martin Kourim
URL:
Whiteboard: api:rest
Depends On:
Blocks: 1551692 1551693
TreeView+ depends on / blocked
 
Reported: 2018-02-26 11:27 UTC by Martin Kourim
Modified: 2018-07-30 14:43 UTC (History)
3 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1551692 1551693 (view as bug list)
Environment:
Last Closed: 2018-07-30 14:43:41 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Martin Kourim 2018-02-26 11:27:36 UTC
Description of problem:
When editing the "current_group" the request fails with:
{
	"error": {
		"kind": "internal_server_error",
		"message": "MiqGroup(#14516000) expected, got Hash(#4780420)",
		"klass": "ActiveRecord::AssociationTypeMismatch"
	}
}

Might be related to https://bugzilla.redhat.com/show_bug.cgi?id=1549085 , only this one happens on both 5.9.0 and 5.8.4

Version-Release number of selected component (if applicable):
5.8.3.4
5.9.0.22


How reproducible:
100%


Steps to Reproduce:
1. create a user
2. POST /api/users/:id
{
    "action": "edit",
    "current_group": {"href": "https://addr/api/groups/13"}
}

Comment 3 CFME Bot 2018-02-27 14:30:46 UTC
New commit detected on ManageIQ/manageiq-api/master:
https://github.com/ManageIQ/manageiq-api/commit/d2e8ea4a43978d95db19af67c0854340e703fb27

commit d2e8ea4a43978d95db19af67c0854340e703fb27
Author:     Jillian Tullo <jtullo>
AuthorDate: Tue Feb 27 08:45:30 2018 -0500
Commit:     Jillian Tullo <jtullo>
CommitDate: Tue Feb 27 08:45:30 2018 -0500

    Raise bad request when current_group is specified on edit
    
    Editing of a current_group is allowed only on on the set_current_group action.
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1549086

 app/controllers/api/users_controller.rb |  4 ++--
 spec/requests/users_spec.rb             | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

Comment 7 Dave Johnson 2018-07-30 14:43:41 UTC
Closing this as its already been verified in two z-streams and has test coverage around it.


Note You need to log in before you can comment on or make changes to this bug.