Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow modification of "Create new Picture" product feature on a role. #18982

Merged

Conversation

jvlcek
Copy link
Member

@jvlcek jvlcek commented Jul 15, 2019

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1727948

The ability to edit a role to enable the Create new Picture product feature was missing.
Prior to this PR the role associated with the user used to issue the Create new Picture
API call must have Everything enable for Product Features.

This PR adds that functionality under the API Product Features, as this functionality is
only available from the API.

Steps for Testing/QA [Optional]

Save the below script and set the image omitted due to size to be a valid image
in file, e.g.: /tmp/create_one_pictures.rb

#!/usr/bin/env ruby

# Jump past this huge data to the bottom of this source file

request_hash =
{
    "extension": "png",
    "content": "image omitted due to size"
}

require 'json'
require 'net/http'
require 'openssl'
require 'uri'

uri = URI.parse("https://#{ENV['MIQ']}/api/pictures")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(uri.request_uri)
request.basic_auth("new_user_2", "smartvm")
request.body = JSON.generate(request_hash)
response = http.request(request)
puts JSON.pretty_generate(JSON.parse(response.body.strip))

Create a new role in ManageIQ
Edit the role and uncheck the Everything box
Click all other boxes next to all other product features, making sure the new
API/Pictures/Create new Picture Product Feature is checked.

Create a new group with the new role create above
Create a new user named, for example, new_user_2

Run the following shell commands on a separate system, e.g.
a laptop on the same network as the ManageIQ appliance:

export MIQ="IP Address to the test MangeIQ appliance"
chmod a+x /tmp/create_one_pictures.rb
/tmp/create_one_pictures.rb

Confirm the new picture was create on the appliance

@miq-bot
Copy link
Member

miq-bot commented Jul 15, 2019

Checked commit jvlcek@5c2aab8 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
0 files checked, 0 offenses detected
Everything looks fine. ⭐

@jvlcek
Copy link
Member Author

jvlcek commented Jul 15, 2019

@miq-bot assign @h-kataria

@jvlcek
Copy link
Member Author

jvlcek commented Jul 15, 2019

@miq-bot add_label bug

@jvlcek
Copy link
Member Author

jvlcek commented Jul 15, 2019

@miq-bot add_label hammer/yes

@h-kataria h-kataria added this to the Sprint 116 Ending Jul 22, 2019 milestone Jul 16, 2019
@h-kataria h-kataria added api and removed api labels Jul 16, 2019
@h-kataria h-kataria merged commit 781bb9e into ManageIQ:master Jul 16, 2019
simaishi pushed a commit that referenced this pull request Jul 22, 2019
Allow modification of "Create new Picture" product feature on a role.

(cherry picked from commit 781bb9e)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1731157
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit dad22d8d50491dff12740ee26ea6b79402fc5842
Author: Harpreet Kataria <[email protected]>
Date:   Tue Jul 16 09:35:50 2019 -0400

    Merge pull request #18982 from jvlcek/bz_1727948_picture_product_feature
    
    Allow modification of "Create new Picture" product feature on a role.
    
    (cherry picked from commit 781bb9e911695c32e2138d910509cfe1c58e71fc)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1731157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants