Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1512644 - Not able to set ownership on service : "None of the selected items allow ownership changes"
Summary: Not able to set ownership on service : "None of the selected items allow owne...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.10.0
Assignee: Milan Zázrivec
QA Contact: Dave Johnson
URL:
Whiteboard: service
Depends On:
Blocks: 1517950
TreeView+ depends on / blocked
 
Reported: 2017-11-13 18:39 UTC by Shveta
Modified: 2018-06-21 21:03 UTC (History)
6 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1517950 (view as bug list)
Environment:
Last Closed: 2018-06-21 21:03:08 UTC
Category: ---
Cloudforms Team: ---


Attachments (Terms of Use)
setownership (deleted)
2017-11-13 18:39 UTC, Shveta
no flags Details

Description Shveta 2017-11-13 18:39:11 UTC
Created attachment 1351655 [details]
setownership

Description of problem:


Version-Release number of selected component (if applicable):
5.9.0.8.20171109215303_ed87902 

How reproducible:


Steps to Reproduce:
1. As admin, Create a catalog item for any provider and order.
2. Navigate to MyService . Select service and then set ownership.
3. Message is displayed : " None of the selected items allow ownership changes"

Actual results:
Able to set ownership from SUI.


Expected results: Should be able to set ownership.

Additional info:

Comment 2 Milan Zázrivec 2017-11-14 08:14:54 UTC
If this really is a problem, then this is a backend problem. It's the model(s) behind, that
informs the UI that the item in question wouldn't allow ownership change. Should the model
allow it, UI would change the ownership just fine.

Comment 3 Greg McCullough 2017-11-14 13:55:47 UTC
Milan - Can you point to the UI code that is making this decision?  What backend method(s) is it using to determine this.  (I looked at a similar issue with some guidance from Harpreet recently and it not find any changes in the backend between two versions that worked.)  Did the UI requirements change for this recently?

Comment 4 Milan Zázrivec 2017-11-14 14:31:04 UTC
Actually, it seems you're right.

First glance at the UI code:

app/controllers/mixins/actions/vm_actions/ownership.rb
... 
def filter_ownership_items(klass, ownership_ids)
  records = find_records_with_rbac(klass.order(:name), ownership_ids)
  records.with_ownership if klass.respond_to?(:with_ownership)
end

might suggest that this indeed is a backend problem, but come to think of it, this is
probably just badly written (or refactored) code.

Correct logic should probably be:

def filter_ownership_items(klass, ownership_ids)
 records = find_records_with_rbac(klass.order(:name), ownership_ids)
 if klass.respond_to?(:with_ownership)
   records.with_ownership if klass.respond_to?(:with_ownership)
 else
   records
 end
end

i.e. if the class in question (Service, Vm, Template, OrchestrationStack) has
with_ownership method, we should do further filtering. Currently,

    records.with_ownership if klass.respond_to?(:with_ownership)

would return nil in case the class doesn't support
with_ownership -> on ownersip operation happens.

I'll fix this in the UI.

Comment 6 CFME Bot 2017-11-27 13:43:36 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:
https://github.com/ManageIQ/manageiq-ui-classic/commit/814a12c78c04487e304d13ddc953cea0db0125f6

commit 814a12c78c04487e304d13ddc953cea0db0125f6
Author:     Milan Zazrivec <mzazrivec@redhat.com>
AuthorDate: Tue Nov 14 15:35:23 2017 +0100
Commit:     Milan Zazrivec <mzazrivec@redhat.com>
CommitDate: Wed Nov 15 13:52:49 2017 +0100

    Fix logic for service ownership
    
    The broken logic would return nil in case the class in question
    (Service, Vm, Template ...) doesn't support (respond to) with_ownership
    class method -> this would seem like the class in question doesn't
    support ownership change.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1512644

 app/controllers/mixins/actions/vm_actions/ownership.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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