Bug 1230884

Summary: hammer role filter does work with ID but not with name
Product: Red Hat Satellite Reporter: Dirk Herrmann <dherrman>
Component: APIAssignee: Eric Helms <ehelms>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: high Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, chpeters, cwelton, mhulan, mmccune, omaciel, pcfe, rdickens, sghai
Target Milestone: UnspecifiedKeywords: ReleaseNotes, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/11303
Whiteboard:
Fixed In Version: Doc Type: Known Issue
Doc Text:
* Issue If you attempt to assign permissions to a role, using the roles' names, you might see the following error message: --- Could not create the permission filter: Permissions Permissions must be of same resource type --- ⁠ * Workaround Specify the roles by their unique identifiers. For example: --- $ hammer filter create --permission-ids 115,116,117,118,119 --role dhtest Permission filter for [Puppetclass] created --- To list available roles and their identifiers, use the following command: --- hammer filter available-permissions ---
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-15 18:20:12 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: 1190823    

Description Dirk Herrmann 2015-06-11 17:09:14 UTC
Description of problem: Using hammer CLI permissions could be assigned using the permission ID but not names:

[dherrman@inf60 ~]$ hammer role create --name dhtest
User role [dhtest] created
[dherrman@inf60 ~]$ hammer filter create --permissions view_puppetclasses,create_puppetclasses,edit_puppetclasses,destroy_puppetclasses,import_puppetclasses --role dhtest
Could not create the permission filter:
  Permissions Permissions must be of same resource type
[dherrman@inf60 ~]$ hammer filter create --permission-ids 115,116,117,118,119 --role dhtest
Permission filter for [Puppetclass] created


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

6.1.0 private beta and GA SNAP 8

How reproducible:

See commands above

Steps to Reproduce:
1.
2.
3.

Actual results:

Using names error message : Permissions Permissions must be of same resource type

Expected results:

Permissions added to this role

Additional info:

Comment 1 RHEL Program Management 2015-06-11 17:12:48 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 4 Marek Hulan 2015-08-20 09:19:58 UTC
Reassigning to Eric which already provided fix. To find ids of permissions you can use following hammer command

  hammer filter available-permissions

The cause is that permissions controller didn't support searching of parameters by scoped search which hammer uses to resolve names to ids.

Comment 7 Bryan Kearney 2015-08-24 13:34:54 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/11303 has been closed
-------------
Eric Helms
Applied in changeset commit:2dec184c083bb0e6a2404de30083f2d8aa491a96.

Comment 9 Sachin Ghai 2015-09-01 10:41:51 UTC
I can still see the original reported issue with sat6.1.2 snap1.

Could not create the permission filter:
  Permissions Permissions must be of same resource type


rubygem-hammer_cli_foreman-0.1.4.14-1.el7sat.noarch
foreman-1.7.2.35-1.el7sat.noarch
ruby193-rubygem-katello-2.2.0.67-1.el7sat.noarch
katello-installer-2.3.18-1.el7sat.noarch
rubygem-hammer_cli_katello-0.0.7.17-1.el7sat.noarch
katello-2.2.0.15-1.el7sat.noarch

Comment 10 Bryan Kearney 2015-09-01 12:04:22 UTC
Upstream bug component is API

Comment 11 Bryan Kearney 2015-09-01 12:04:23 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/11303 has been closed
-------------
Eric Helms
Applied in changeset commit:2dec184c083bb0e6a2404de30083f2d8aa491a96.

Comment 14 Og Maciel 2015-10-05 20:08:08 UTC
Using permission names:

hammer> role create --name dhtest
User role [dhtest] created

hammer> filter create --permissions view_puppetclasses,create_puppetclasses,edit_puppetclasses,destroy_puppetclasses,import_puppetclasses --role dhtest
Permission filter for [Puppetclass] created

hammer> filter info --id 164
Id:            164
Resource type: Puppetclass
Search:        none
Unlimited?:    yes
Role:          dhtest
Permissions:   view_puppetclasses, create_puppetclasses, edit_puppetclasses, destroy_puppetclasses, import_puppetclasses
Created at:    2015/10/05 20:02:40
Updated at:    2015/10/05 20:02:40


Using permission IDs:

hammer> role create --name dhtest2
User role [dhtest2] created

hammer> filter create --permission-ids 115,116,117,118,119 --role dhtest2
Permission filter for [Puppetclass] created

hammer> filter info --id 165
Id:            165
Resource type: Puppetclass
Search:        none
Unlimited?:    yes
Role:          dhtest2
Permissions:   view_puppetclasses, create_puppetclasses, edit_puppetclasses, destroy_puppetclasses, import_puppetclasses
Created at:    2015/10/05 20:07:16
Updated at:    2015/10/05 20:07:16

Comment 15 Og Maciel 2015-10-05 20:10:03 UTC
Verified using Satellite-6.1.0-RHEL-7-20151002.0 compose/

Comment 17 errata-xmlrpc 2015-10-15 18:20:12 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/RHBA-2015:1911