Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1230884 - hammer role filter does work with ID but not with name
hammer role filter does work with ID but not with name
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
6.1.0
Unspecified Unspecified
unspecified Severity high (vote)
: 6.1.3
: Unused
Assigned To: Eric Helms
Og Maciel
Russell Dickenson
http://projects.theforeman.org/issues...
: ReleaseNotes, Triaged
Depends On:
Blocks: sat61-release-notes
  Show dependency treegraph
 
Reported: 2015-06-11 13:09 EDT by Dirk Herrmann
Modified: 2017-02-23 14:56 EST (History)
9 users (show)

See Also:
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 14:20:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 11303 None None None 2016-04-22 10:55 EDT
Red Hat Product Errata RHBA-2015:1911 normal SHIPPED_LIVE Satellite 6.1.3 bug fix update 2015-10-15 18:19:19 EDT

  None (edit)
Description Dirk Herrmann 2015-06-11 13:09:14 EDT
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 Product and Program Management 2015-06-11 13:12:48 EDT
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 05:19:58 EDT
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 09:34:54 EDT
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 06:41:51 EDT
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 08:04:22 EDT
Upstream bug component is API
Comment 11 Bryan Kearney 2015-09-01 08:04:23 EDT
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 16:08:08 EDT
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 16:10:03 EDT
Verified using Satellite-6.1.0-RHEL-7-20151002.0 compose/
Comment 17 errata-xmlrpc 2015-10-15 14:20:12 EDT
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

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