Bug 1488908

Summary: [CLI and API] Role cloning, copies its taxonomies as well
Product: Red Hat Satellite Reporter: Jitendra Yejare <jyejare>
Component: Users & RolesAssignee: Dominik Hlavac Duran <dhlavacd>
Status: CLOSED ERRATA QA Contact: vijsingh
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: aagrawal, bkearney, dhlavacd, egolov, mhulan, oprazak
Target Milestone: 6.6.0Keywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-1.21.0-0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 19:50:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1373844    

Description Jitendra Yejare 2017-09-06 12:47:28 UTC
Description of problem:
From Hammer CLI, If you clone a role that has taxonomies, then after cloning the same taxonomies are copied over to the cloned role.

This behavior is not same from UI


Version-Release number of selected component (if applicable):
Satellite 6.3.0 snap 14

How reproducible:
Always

Steps to Reproduce:
1. Create a role with org A and location A
2. Clone above role from hammer CLI without providing any org and location id's
# hammer role clone --id 45 --new-name clied_cloned

Actual results:
The cloned role has taxonomies copied from its parent role

Expected results:
Cloned role should not have any taxonomies

Additional info:

Comment 2 Jitendra Yejare 2017-09-14 12:40:17 UTC
This issue is reproducible from API end as well.

Also, this issue is affecting 6.3 feature 'Canned Role Org Admin' from API end.

Comment 3 Ondřej Pražák 2017-11-01 12:59:46 UTC
Created redmine issue http://projects.theforeman.org/issues/21545 from this bug

Comment 5 Bryan Kearney 2018-10-03 19:17:38 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Rich Jerrido or Bryan Kearney. Thank you.

Comment 6 Jitendra Yejare 2018-10-09 08:56:49 UTC
This was really required to fix as its the basics of satellites role-based authentication. This is affecting the way role filter behaves after cloning and hence need to fix. 

Reopening as per discussion with MHulan.

Comment 7 Bryan Kearney 2018-11-01 14:43:48 UTC
The Satellite Team is attempting to provide an accurate backlog of bugzilla requests which we feel will be resolved in the next few releases. We do not believe this bugzilla will meet that criteria, and have plans to close it out in 1 month. This is  not a reflection on the validity of the request, but a reflection of the many priorities for the product. If you have any concerns about this, feel free to contact Rich Jerrido or Bryan Kearney or your account team. If we do not hear from you, we will close this bug out. Thank you.

Comment 8 Bryan Kearney 2018-11-06 13:20:52 UTC
This is a work in progress upstream per Marek. We will keep this open and not close it.

Comment 9 Satellite Program 2018-12-17 15:08:08 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/21545 has been resolved.

Comment 11 Ondřej Pražák 2019-06-04 10:49:47 UTC
The patch should fix inconsistencies, organizations and locations are now assigned to the cloned role by default in both API/UI. If you need to modify what orgs/locs the clone has, it can be done by selecting/deselecting items in UI before the form is submitted or by passing --locations and --organizations flags to the hammer command.

Running 'hammer role clone --id 30 --new-name cloned_role' will assign all the organizations and locations from role with id 30 to cloned_role.
In UI, the form for clone should have preselected the taxonomies from the original role.

Comment 12 vijsingh 2019-06-04 12:25:15 UTC
ON_QA Verified:

@Satellite 6.6.0 snap 5.0

Steps:
A. with CLI:

 1. Created a role with org A and location A
 2. Clone above role from hammer CLI without providing any org and location id's

~~~~~~~~~~~~~~~~~~~~~~
[root@intel-canoepass-09 ~]# hammer role clone --id 30 --new-name clone_test
User role cloned.
[root@intel-canoepass-09 ~]# hammer role info --id 31
Id:            31
Name:          clone_test
Builtin:       no
Description:   
Locations:      
    Default Location            <=========
Organizations: 
    Default Organization        <=========

~~~~~~~~~~~~~~~~~~~~~~

B. With UI also observed the same.
 
  Screenshot attached


Observation:

 The cloned role has taxonomies copied from its parent role from CLI/UI too.

Comment 13 vijsingh 2019-06-04 12:49:10 UTC
Created attachment 1577052 [details]
Screenshots

Comment 15 Bryan Kearney 2019-10-22 19:50:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3172