Project

General

Profile

Actions

Bug #37430

closed

Content Exporter role is missing the create_content_views permission

Added by Sayan Das 11 days ago. Updated 5 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Roles and Permissions
Target version:
Difficulty:
easy
Triaged:
Yes
Fixed in Releases:

Description

It's common to have a non-admin user with specific role trying to perform a specific task through API and in case of exporting some content ( library\repo\cv version ), When using "Content Exporter" role with an user, then export attempt via that user will always end up failing with errors like this i.e.

Could not export the repository:
  Validation failed: Label has already been taken, Name has already been taken

Trace:

2024-05-09T16:00:45 [I|aud|4e8d0c49] Katello::ContentView (10) create event on generated_for 2
2024-05-09T16:00:45 [I|aud|4e8d0c49] Katello::ContentView (10) create event on repository_ids []
2024-05-09T16:00:45 [I|aud|4e8d0c49] Katello::ContentView (10) create event on environment_ids []
2024-05-09T16:00:45 [I|aud|4e8d0c49] Katello::ContentView (10) create event on filter_ids []
2024-05-09T16:00:45 [E|bac|4e8d0c49] Validation failed: Label has already been taken, Name has already been taken (ActiveRecord::RecordInvalid)
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/validations.rb:80:in `raise_validation_error'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/validations.rb:53:in `save!'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:302:in `block in save!'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:318:in `transaction'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:302:in `save!'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/suppressor.rb:48:in `save!'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/persistence.rb:639:in `block in update!'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:318:in `transaction'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
 4e8d0c49 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/persistence.rb:637:in `update!'
 4e8d0c49 | /usr/share/gems/gems/katello-4.11.0.9/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb:17:in `plan'

This is because, When it was time to create the Content View, The user did not have enough permission to work with.

# hammer role filters --name "Content Exporter" 
----|----------------------|--------|------------|-----------|------------------|-----------------------------------
ID  | RESOURCE TYPE        | SEARCH | UNLIMITED? | OVERRIDE? | ROLE             | PERMISSIONS                       
----|----------------------|--------|------------|-----------|------------------|-----------------------------------
249 | Katello::ContentView | none   | yes        | no        | Content Exporter | view_content_views                
250 | Organization         | none   | yes        | no        | Content Exporter | export_content, view_organizations
251 | Katello::Product     | none   | yes        | no        | Content Exporter | view_products                     
----|----------------------|--------|------------|-----------|------------------|-----------------------------------


We simply need to add create_content_views permission in that specific role.
Actions #1

Updated by Sayan Das 11 days ago

  • Description updated (diff)
Actions #2

Updated by The Foreman Bot 11 days ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/10991 added
Actions #3

Updated by Sayan Das 11 days ago

  • Found in Releases Katello 4.10.0, Katello 4.11.0, Katello 4.10.1 added
Actions #4

Updated by The Foreman Bot 7 days ago

  • Fixed in Releases Katello 4.13.0 added
Actions #5

Updated by Sayan Das 7 days ago

  • Status changed from Ready For Testing to Closed
Actions #6

Updated by Partha Aji 5 days ago

  • Target version set to Katello 4.12.1
  • Triaged changed from No to Yes
Actions

Also available in: Atom PDF