Skip to content

Commit

Permalink
[6.16.z] Add permission tests for foreman_salt (#16984)
Browse files Browse the repository at this point in the history
Add permission tests for foreman_salt (#16962)

(cherry picked from commit 4e276e0)

Co-authored-by: dosas <dosas@users.noreply.github.com>
  • Loading branch information
Satellite-QE and dosas authored Nov 28, 2024
1 parent 3f8eb05 commit 81e0c57
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
34 changes: 33 additions & 1 deletion robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,31 @@
'destroy_external_usergroups',
],
'FactValue': ['view_facts', 'upload_facts'],
'Filter': ['view_filters', 'create_filters', 'edit_filters', 'destroy_filters'],
'Filter': [
'view_filters',
'create_filters',
'edit_filters',
'destroy_filters',
],
'ForemanSalt::SaltVariable': [
'edit_salt_variables',
'destroy_salt_variables',
'create_salt_variables',
'view_salt_variables',
],
'ForemanSalt::SaltEnvironment': [
'edit_salt_environments',
'create_salt_environments',
'destroy_salt_environments',
'view_salt_environments',
],
'ForemanSalt::SaltModule': [
'import_salt_modules',
'create_salt_modules',
'edit_salt_modules',
'view_salt_modules',
'destroy_salt_modules',
],
'ForemanTasks::RecurringLogic': [
'create_recurring_logics',
'view_recurring_logics',
Expand Down Expand Up @@ -1181,6 +1205,13 @@
'manage_capsule_content',
'view_capsule_content',
'view_openscap_proxies',
'destroy_smart_proxies_salt_autosign',
'view_smart_proxies_salt_autosign',
'destroy_smart_proxies_salt_keys',
'view_smart_proxies_salt_keys',
'edit_smart_proxies_salt_keys',
'auth_smart_proxies_salt_autosign',
'create_smart_proxies_salt_autosign',
],
'SshKey': ["view_ssh_keys", "create_ssh_keys", "destroy_ssh_keys"],
'Subnet': [
Expand Down Expand Up @@ -1229,6 +1260,7 @@
'view_discovered_hosts',
'view_hosts',
'forget_status_hosts',
'saltrun_hosts',
],
'Katello::ActivationKey': [
'view_activation_keys',
Expand Down
12 changes: 12 additions & 0 deletions tests/foreman/api/test_permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ def create_permissions(self, class_target_sat):
if 'rubygem-foreman_scc_manager' not in rpm_packages:
cls.permissions.pop('SccAccount')
cls.permissions.pop('SccProduct')
if 'rubygem-foreman_salt' not in rpm_packages:
cls.permissions['Host'].remove('saltrun_hosts')
cls.permissions['SmartProxy'].remove('destroy_smart_proxies_salt_autosign')
cls.permissions['SmartProxy'].remove('view_smart_proxies_salt_autosign')
cls.permissions['SmartProxy'].remove('destroy_smart_proxies_salt_keys')
cls.permissions['SmartProxy'].remove('view_smart_proxies_salt_keys')
cls.permissions['SmartProxy'].remove('edit_smart_proxies_salt_keys')
cls.permissions['SmartProxy'].remove('auth_smart_proxies_salt_autosign')
cls.permissions['SmartProxy'].remove('create_smart_proxies_salt_autosign')
cls.permissions.pop('ForemanSalt::SaltVariable')
cls.permissions.pop('ForemanSalt::SaltEnvironment')
cls.permissions.pop('ForemanSalt::SaltModule')

#: e.g. ['Architecture', 'Audit', 'AuthSourceLdap', …]
cls.permission_resource_types = list(cls.permissions.keys())
Expand Down

0 comments on commit 81e0c57

Please sign in to comment.