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

Add RBAC and Tagging Support to Ansible Repositories #3513

Merged

Conversation

hstastna
Copy link

@hstastna hstastna commented Mar 5, 2018

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1526217
Needs to merge with: [SOLVED/merged]
ManageIQ/manageiq#17083 (tagging support to main MIQ repo)
ManageIQ/manageiq#17091 (RBAC support)


Done:

  • add Policy toolbar button to access tagging in Automation > Ansible > Repositories
    (Policy > Edit Tags)
  • add tagging_edit and tag_edit_form_field_changed to routes to enable tagging for Ansible Repos or for proper rendering of tagging screen
  • add calling tag method to button method in ansible credential controller and also small refactoring of button method, in that controller
  • display tags in the table in summary page of any credential
  • make tagging work also from summary page of any credential
  • check if RBAC works - it should work after merging Add ConfigurationScriptSource to RBAC manageiq#17091
  • spec test for button method in ansible repository controller

Before:
repos_before
repository_summary_no_tag

After:
repos_after
repos_tag_page
tag_success
repository_summary

Note:
How to check RBAC support (one of possible scenarios):

  1. as an admin, tag some repo(s) from Automation > Ansible > Repositories,
    remember those tags
  2. in Configuration > Access Control > Groups, create a group so that under Assigned Filters in the first tab called My Company Tags, you choose the same tags as tags from step 1.
  3. set EvmRole-administrator as a role of that group (not super administrator!) and save the group
  4. create a user with that group from step 3.
  5. logout and login as the user from step 4.
  6. go to Automation > Ansible > Repositories and you should see only the repositories with the same tags as from step 2.

@hstastna
Copy link
Author

hstastna commented Mar 5, 2018

@miq-bot add_label automation/ansible, blocker, enhancement, gaprindashvili/yes, pending core

@hstastna hstastna force-pushed the Add_RBAC_Tagging_Ansible_Repos_ui branch from 4865240 to b703a15 Compare March 5, 2018 21:11
@hstastna hstastna changed the title Add RBAC and Tagging Support to Ansible Repositories [WIP] Add RBAC and Tagging Support to Ansible Repositories Mar 6, 2018
@miq-bot miq-bot added the wip label Mar 6, 2018
Hilda Stastna added 4 commits March 6, 2018 10:08
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526217

Add Policy toolbar button to enable tagging in Automation > Ansible > Repositories.
Add also tag_edit_form_field_changed for proper rendering of tagging screen.
Add calling tag method to button method in ansible repository controller
and also small refactoring of button method, for tagging support of
Ansible Repositories.
Add displaying tags in the table in summary screen of a chosen repository,
in Automation > Ansible > Repositories.
@hstastna hstastna force-pushed the Add_RBAC_Tagging_Ansible_Repos_ui branch from b703a15 to f0c82db Compare March 6, 2018 09:34
Add Policy toolbar button to enable tagging of any Ansible Repository
from its summary page.
@hstastna hstastna changed the title [WIP] Add RBAC and Tagging Support to Ansible Repositories Add RBAC and Tagging Support to Ansible Repositories Mar 6, 2018
@miq-bot miq-bot removed the wip label Mar 6, 2018
@miq-bot
Copy link
Member

miq-bot commented Mar 6, 2018

Checked commits hstastna/manageiq-ui-classic@8fce5f1~...f7ca15a with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
6 files checked, 0 offenses detected
Everything looks fine. 🏆

@hstastna
Copy link
Author

hstastna commented Mar 6, 2018

@h-kataria @dclarizio @martinpovolny Adding RBAC and Tagging Support to Ansible Repos done so now I would need some review. Thanks so much! :)

@h-kataria
Copy link
Contributor

looks good, ready to merge once Travis is green.

@h-kataria
Copy link
Contributor

@himdel can you look at Javascript test failures.

@h-kataria h-kataria added this to the Sprint 81 Ending Mar 12, 2018 milestone Mar 7, 2018
@h-kataria h-kataria merged commit 4ee1690 into ManageIQ:master Mar 7, 2018
simaishi pushed a commit that referenced this pull request Mar 9, 2018
Add RBAC and Tagging Support to Ansible Repositories
(cherry picked from commit 4ee1690)

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

simaishi commented Mar 9, 2018

Gaprindashvili backport details:

$ git log -1
commit 2f657322dada3c23f9a8e8c75742514c94c8a2a9
Author: Harpreet Kataria <hkataria@redhat.com>
Date:   Wed Mar 7 10:51:40 2018 -0500

    Merge pull request #3513 from hstastna/Add_RBAC_Tagging_Ansible_Repos_ui
    
    Add RBAC and Tagging Support to Ansible Repositories
    (cherry picked from commit 4ee16906b77aa31cb863c3f6c0a3570cd044908e)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1553396

@simaishi
Copy link
Contributor

simaishi commented Mar 9, 2018

@hstastna Travis is failing in gaprindashvili branch. Please take a look.

  1) AnsibleRepositoryController#button editing an existing repository redirects to action edit
     Failure/Error: ApplicationRecord.uncompress_id(cid)
     NoMethodError:
       undefined method `to_i' for [123]:Array
     # ./app/controllers/mixins/compressed_ids.rb:13:in `from_cid'
     # ./app/controllers/ansible_repository_controller.rb:31:in `button'
     # ./spec/controllers/ansible_repository_controller_spec.rb:70:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:73:in `block (3 levels) in <top (required)>'
     # ./spec/manageiq/spec/support/evm_spec_helper.rb:35:in `clear_caches'
     # ./spec/spec_helper.rb:73:in `block (2 levels) in <top (required)>'

@hstastna
Copy link
Author

hstastna commented Mar 9, 2018

@simaishi If is failing because I've written spec tests for master branch, for the newest code and also for the parts of the code I haven't written. The older code is different, it looks like it still uses compressed ids which were, I think, removed from the newest code. And that's not related to this PR. Anyway, I will try to fix that failing spec test for gaprindashvili branch

@simaishi
Copy link
Contributor

simaishi commented Mar 9, 2018

Yes, I realized that code has changed between master/gaprindashvili. But since that failing test was added in this PR, I've added the info here 😄 Thanks for fixing!

hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Mar 9, 2018
@hstastna
Copy link
Author

hstastna commented Mar 9, 2018

@simaishi So finally it was not hard fix: #3563

@hstastna
Copy link
Author

hstastna commented Apr 5, 2018

@miq-bot add_label test

@miq-bot miq-bot added the test label Apr 5, 2018
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