katello 3.16.0.rc4 → 3.17.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (383) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/katello/katello.scss +3 -7
  3. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +39 -23
  4. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
  5. data/app/controllers/katello/api/v2/activation_keys_controller.rb +8 -0
  6. data/app/controllers/katello/api/v2/api_controller.rb +1 -0
  7. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +5 -1
  8. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +3 -0
  9. data/app/controllers/katello/api/v2/content_views_controller.rb +7 -0
  10. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +10 -4
  11. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +10 -0
  12. data/app/controllers/katello/api/v2/repositories_controller.rb +4 -1
  13. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +16 -0
  14. data/app/controllers/katello/concerns/api/v2/associations_permission_check.rb +67 -0
  15. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +4 -4
  16. data/app/controllers/katello/concerns/api/v2/hostgroups_controller_extensions.rb +1 -1
  17. data/app/helpers/katello/concerns/dashboard_helper_extensions.rb +10 -0
  18. data/app/helpers/katello/content_view_helper.rb +15 -0
  19. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +6 -7
  20. data/app/lib/actions/candlepin/product/content_add.rb +2 -1
  21. data/app/lib/actions/candlepin/product/content_update_enablement.rb +18 -0
  22. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +4 -0
  23. data/app/lib/actions/katello/capsule_content/sync.rb +2 -5
  24. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +16 -16
  25. data/app/lib/actions/katello/content_view/incremental_updates.rb +8 -1
  26. data/app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb +2 -1
  27. data/app/lib/actions/katello/content_view/publish.rb +55 -16
  28. data/app/lib/actions/katello/content_view_version/incremental_update.rb +120 -26
  29. data/app/lib/actions/katello/host/attach_subscriptions.rb +5 -1
  30. data/app/lib/actions/katello/organization/simple_content_access/disable.rb +17 -0
  31. data/app/lib/actions/katello/organization/simple_content_access/enable.rb +17 -0
  32. data/app/lib/actions/katello/organization/simple_content_access/toggle.rb +36 -0
  33. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +13 -0
  34. data/app/lib/actions/katello/product/content_create.rb +3 -3
  35. data/app/lib/actions/katello/repository/content_update.rb +41 -0
  36. data/app/lib/actions/katello/repository/export.rb +1 -1
  37. data/app/lib/actions/katello/repository/multi_clone_contents.rb +66 -0
  38. data/app/lib/actions/katello/repository/multi_clone_to_version.rb +30 -0
  39. data/app/lib/actions/katello/repository/update.rb +4 -20
  40. data/app/lib/actions/katello/sync_plan/run.rb +1 -1
  41. data/app/lib/actions/pulp/abstract_async_task.rb +1 -0
  42. data/app/lib/actions/pulp/consumer/sync_capsule.rb +8 -0
  43. data/app/lib/actions/pulp/orchestration/repository/smart_proxy_sync.rb +1 -0
  44. data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +2 -2
  45. data/app/lib/actions/pulp3/abstract_async_task.rb +62 -58
  46. data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +17 -0
  47. data/app/lib/actions/pulp3/{ContentGuard → content_guard}/refresh.rb +0 -0
  48. data/app/lib/actions/pulp3/content_migration.rb +4 -0
  49. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +1 -2
  50. data/app/lib/actions/pulp3/orchestration/repository/multi_copy_all_units.rb +36 -0
  51. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +28 -0
  52. data/app/lib/actions/pulp3/repository/multi_copy_units.rb +55 -0
  53. data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +1 -1
  54. data/app/lib/actions/pulp3/repository/save_version.rb +11 -3
  55. data/app/lib/actions/pulp3/repository/save_versions.rb +73 -0
  56. data/app/lib/katello/concerns/base_template_scope_extensions.rb +4 -14
  57. data/app/lib/katello/errors.rb +1 -15
  58. data/app/lib/katello/resources/candlepin/product.rb +11 -0
  59. data/app/lib/katello/util/cdn_var_substitutor.rb +1 -0
  60. data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +11 -11
  61. data/app/models/katello/activation_key.rb +1 -1
  62. data/app/models/katello/concerns/content_facet_host_extensions.rb +7 -0
  63. data/app/models/katello/concerns/host_managed_extensions.rb +39 -0
  64. data/app/models/katello/concerns/hostgroup_extensions.rb +46 -24
  65. data/app/models/katello/concerns/smart_proxy_extensions.rb +2 -5
  66. data/app/models/katello/concerns/widget_extensions.rb +23 -0
  67. data/app/models/katello/content_view.rb +27 -7
  68. data/app/models/katello/content_view_erratum_filter.rb +13 -0
  69. data/app/models/katello/content_view_filter.rb +4 -0
  70. data/app/models/katello/content_view_module_stream_filter.rb +30 -3
  71. data/app/models/katello/content_view_version.rb +7 -0
  72. data/app/models/katello/erratum.rb +13 -0
  73. data/app/models/katello/erratum_cve.rb +8 -0
  74. data/app/models/katello/glue/pulp/repo.rb +1 -0
  75. data/app/models/katello/host/content_facet.rb +28 -5
  76. data/app/models/katello/host_collection.rb +6 -0
  77. data/app/models/katello/hostgroup/content_facet.rb +18 -0
  78. data/app/models/katello/installed_package.rb +8 -0
  79. data/app/models/katello/kt_environment.rb +9 -1
  80. data/app/models/katello/model.rb +16 -0
  81. data/app/models/katello/module_stream.rb +1 -1
  82. data/app/models/katello/ping.rb +1 -3
  83. data/app/models/katello/pool.rb +17 -0
  84. data/app/models/katello/product.rb +6 -0
  85. data/app/models/katello/purpose_addons_status.rb +1 -0
  86. data/app/models/katello/purpose_role_status.rb +1 -0
  87. data/app/models/katello/purpose_sla_status.rb +1 -0
  88. data/app/models/katello/purpose_usage_status.rb +1 -0
  89. data/app/models/katello/repository.rb +14 -1
  90. data/app/models/katello/root_repository.rb +23 -11
  91. data/app/models/katello/subscription_status.rb +1 -1
  92. data/app/models/katello/trace_status.rb +1 -1
  93. data/app/models/setting/content.rb +8 -2
  94. data/app/presenters/katello/sync_status_presenter.rb +4 -2
  95. data/app/services/katello/event_daemon.rb +7 -8
  96. data/app/services/katello/host_status_manager.rb +13 -0
  97. data/app/services/katello/pulp/repository/yum.rb +2 -1
  98. data/app/services/katello/pulp3/api/core.rb +4 -0
  99. data/app/services/katello/pulp3/erratum.rb +3 -1
  100. data/app/services/katello/pulp3/migration.rb +9 -4
  101. data/app/services/katello/pulp3/migration_plan.rb +6 -6
  102. data/app/services/katello/pulp3/repository.rb +10 -1
  103. data/app/services/katello/pulp3/repository/yum.rb +179 -25
  104. data/app/services/katello/pulp3/repository_mirror.rb +7 -2
  105. data/app/services/katello/pulp3/task.rb +100 -0
  106. data/app/services/katello/pulp3/task_group.rb +79 -0
  107. data/app/views/foreman/smart_proxies/_content_sync.html.erb +1 -1
  108. data/app/views/katello/api/v2/content_view_filters/base.json.rabl +4 -0
  109. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
  110. data/config/routes/api/v2.rb +2 -0
  111. data/db/migrate/20141222151001_add_host_content_view_environment.rb +1 -1
  112. data/db/migrate/20180904122343_create_hostgroup_content_facet.katello.rb +16 -0
  113. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +53 -0
  114. data/db/migrate/20200610112009_remove_audits_of_root_repo_with_content_id.rb +9 -0
  115. data/db/migrate/20200701150946_add_auto_enabled_to_root_repository.rb +5 -0
  116. data/db/migrate/20200709021250_add_original_modules_to_content_view_module_stream_filter.rb +5 -0
  117. data/db/migrate/20200721142707_remove_duplicate_katello_pools_index.rb +5 -0
  118. data/db/seeds.d/75-job_templates.rb +2 -2
  119. data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +3 -1
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +5 -2
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +4 -2
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-add-subscriptions.html +1 -1
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html +2 -2
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +1 -1
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.routes.js +1 -13
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +4 -1
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-packages-modal.controller.js +4 -1
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +1 -0
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-environment-modal.html +7 -1
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -0
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +1 -0
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +4 -2
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.routes.js +1 -1
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +7 -1
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +4 -2
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-add-subscriptions.html +1 -1
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-details.html +1 -0
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +14 -6
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions-list.html +1 -1
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +6 -6
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-details.controller.js +17 -4
  142. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/module-stream-filter-details.html +17 -0
  143. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.routes.js +1 -1
  144. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +5 -2
  145. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +1 -1
  146. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +45 -4
  147. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +1 -1
  148. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +1 -1
  149. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +1 -1
  150. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +1 -1
  151. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +1 -1
  152. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +1 -1
  153. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +1 -1
  154. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +1 -1
  155. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +1 -1
  156. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +1 -1
  157. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +10 -0
  158. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +1 -1
  159. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +14 -2
  160. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
  161. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +4 -0
  162. data/lib/katello/engine.rb +6 -6
  163. data/lib/katello/permission_creator.rb +1 -1
  164. data/lib/katello/plugin.rb +22 -17
  165. data/lib/katello/tasks/reports.rake +4 -0
  166. data/lib/katello/tasks/test.rake +15 -0
  167. data/lib/katello/version.rb +1 -1
  168. data/locale/action_names.rb +48 -48
  169. data/locale/bn/katello.po +137 -14
  170. data/locale/cs/katello.po +137 -14
  171. data/locale/de/katello.po +138 -15
  172. data/locale/en/katello.po +137 -14
  173. data/locale/es/katello.po +138 -15
  174. data/locale/fr/katello.po +138 -15
  175. data/locale/gu/katello.po +137 -14
  176. data/locale/hi/katello.po +137 -14
  177. data/locale/it/katello.po +138 -15
  178. data/locale/ja/katello.po +138 -15
  179. data/locale/katello.pot +969 -769
  180. data/locale/kn/katello.po +137 -14
  181. data/locale/ko/katello.po +138 -15
  182. data/locale/mr/katello.po +137 -14
  183. data/locale/or/katello.po +137 -14
  184. data/locale/pa/katello.po +137 -14
  185. data/locale/pt/katello.po +137 -14
  186. data/locale/pt_BR/katello.po +138 -15
  187. data/locale/ru/katello.po +138 -15
  188. data/locale/ta/katello.po +137 -14
  189. data/locale/te/katello.po +137 -14
  190. data/locale/zh_CN/katello.po +138 -15
  191. data/locale/zh_TW/katello.po +138 -15
  192. data/package.json +8 -25
  193. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +3 -0
  194. data/webpack/components/ActionableDetail.js +63 -0
  195. data/webpack/components/Content/ContentTable.js +2 -2
  196. data/webpack/components/Content/Details/ContentDetailRepositoryTableSchema.js +1 -1
  197. data/webpack/components/Content/Details/ContentDetails.js +1 -1
  198. data/webpack/components/Content/__tests__/ContentTable.test.js +2 -2
  199. data/webpack/components/Content/__tests__/__snapshots__/ContentPage.test.js.snap +1 -1
  200. data/webpack/components/EditableSwitch.js +30 -0
  201. data/webpack/components/EditableTextInput/EditableTextInput.js +120 -0
  202. data/webpack/components/EditableTextInput/__tests__/editableTextInput.test.js +52 -0
  203. data/webpack/components/EditableTextInput/editableTextInput.scss +14 -0
  204. data/webpack/components/EditableTextInput/index.js +3 -0
  205. data/webpack/{scenes/ContentViews/components → components}/Loading.js +8 -5
  206. data/webpack/{move_to_pf → components}/LoadingState/LoadingState.js +0 -0
  207. data/webpack/{move_to_pf → components}/LoadingState/LoadingState.scss +0 -0
  208. data/webpack/{move_to_pf → components}/LoadingState/LoadingState.test.js +0 -0
  209. data/webpack/{move_to_pf → components}/LoadingState/__snapshots__/LoadingState.test.js.snap +0 -0
  210. data/webpack/{move_to_pf → components}/LoadingState/index.js +0 -0
  211. data/webpack/components/MultiSelect/index.js +1 -1
  212. data/webpack/{move_to_pf → components}/OptionTooltip/OptionTooltip.scss +0 -0
  213. data/webpack/{move_to_pf → components}/OptionTooltip/__tests__/OptionTooltip.test.js +0 -0
  214. data/webpack/{move_to_pf → components}/OptionTooltip/__tests__/__snapshots__/OptionTooltip.test.js.snap +0 -0
  215. data/webpack/{move_to_pf → components}/OptionTooltip/index.js +0 -0
  216. data/webpack/components/Search/Search.js +124 -0
  217. data/webpack/components/Search/Search.test.js +2 -1
  218. data/webpack/components/Search/__snapshots__/Search.test.js.snap +2 -0
  219. data/webpack/components/Search/__tests__/search.test.js +124 -0
  220. data/webpack/components/Search/index.js +11 -87
  221. data/webpack/{move_to_pf → components}/Select/Select.js +0 -0
  222. data/webpack/components/SelectOrg/SetOrganization.js +2 -2
  223. data/webpack/components/TabWrapper/TabWrapper.js +26 -0
  224. data/webpack/components/TabWrapper/index.js +3 -0
  225. data/webpack/components/TabbedView/TabbedView.js +38 -0
  226. data/webpack/components/TabbedView/TabbedView.scss +3 -0
  227. data/webpack/components/TabbedView/index.js +3 -0
  228. data/webpack/components/Table/EmptyStateMessage.js +61 -0
  229. data/webpack/{scenes/ContentViews/Table/TableWrapper.js → components/Table/MainTable.js} +23 -12
  230. data/webpack/components/Table/TableWrapper.js +94 -0
  231. data/webpack/{move_to_pf → components}/TooltipButton/TooltipButton.js +0 -0
  232. data/webpack/{move_to_pf → components}/TooltipButton/TooltipButton.scss +0 -0
  233. data/webpack/{move_to_pf → components}/TooltipButton/TooltipButton.test.js +0 -0
  234. data/webpack/{move_to_pf → components}/TooltipButton/__snapshots__/TooltipButton.test.js.snap +0 -0
  235. data/webpack/{move_to_pf → components}/TooltipButton/index.js +0 -0
  236. data/webpack/components/TypeAhead/TypeAhead.js +109 -0
  237. data/webpack/{move_to_pf → components}/TypeAhead/TypeAhead.scss +0 -0
  238. data/webpack/components/TypeAhead/helpers/commonPropTypes.js +35 -0
  239. data/webpack/components/TypeAhead/helpers/helpers.js +32 -0
  240. data/webpack/components/TypeAhead/index.js +3 -0
  241. data/webpack/{move_to_pf/TypeAhead → components/TypeAhead/pf3Search}/TypeAheadInput.js +3 -6
  242. data/webpack/{move_to_pf/TypeAhead → components/TypeAhead/pf3Search}/TypeAheadItems.js +3 -7
  243. data/webpack/components/TypeAhead/pf3Search/TypeAheadSearch.js +52 -0
  244. data/webpack/components/TypeAhead/pf4Search/TypeAheadInput.js +44 -0
  245. data/webpack/components/TypeAhead/pf4Search/TypeAheadInput.scss +11 -0
  246. data/webpack/components/TypeAhead/pf4Search/TypeAheadItems.js +57 -0
  247. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +66 -0
  248. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.scss +5 -0
  249. data/webpack/components/extensions/about/__tests__/SystemStatuses.test.js +1 -1
  250. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/CollapseSubscriptionGroupButton.js +0 -0
  251. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/CollapseSubscriptionGroupButton.test.js +0 -0
  252. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/Table.js +0 -0
  253. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/Table.test.js +0 -0
  254. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableBody.js +0 -0
  255. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableBody.test.js +0 -0
  256. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableBodyMessage.js +0 -0
  257. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableBodyMessage.test.js +0 -0
  258. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableFixtures.js +0 -0
  259. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableSelectionCell.js +0 -0
  260. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableSelectionCell.test.js +0 -0
  261. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableSelectionHeaderCell.js +0 -0
  262. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableSelectionHeaderCell.test.js +0 -0
  263. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +0 -0
  264. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/Table.test.js.snap +0 -0
  265. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/TableBody.test.js.snap +0 -0
  266. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/TableBodyMessage.test.js.snap +0 -0
  267. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/TableSelectionCell.test.js.snap +0 -0
  268. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +0 -0
  269. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/index.js +0 -0
  270. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/EntitlementsInlineEditFormatter.js +1 -1
  271. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/__tests__/EntitlementsInlineEditFormatter.test.js +0 -0
  272. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/__tests__/__snapshots__/EntitlementsInlineEditFormatter.test.js.snap +0 -0
  273. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/cellFormatter.js +0 -0
  274. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/collapseableAndSelectionCellFormatter.js +0 -0
  275. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/ellipsisCellFormatter.js +0 -0
  276. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/headerFormatter.js +0 -0
  277. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/index.js +0 -0
  278. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/selectionCellFormatter.js +0 -0
  279. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/selectionHeaderCellFormatter.js +0 -0
  280. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/index.js +0 -0
  281. data/webpack/{move_to_pf → components}/react-bootstrap-select/index.js +0 -0
  282. data/webpack/containers/Application/config.js +5 -0
  283. data/webpack/containers/Application/overrides.scss +5 -0
  284. data/webpack/global_test_setup.js +3 -1
  285. data/webpack/redux/OrganizationProducts/OrganizationProductsActions.js +1 -1
  286. data/webpack/redux/OrganizationProducts/__tests__/OrganizationProductsActions.test.js +2 -2
  287. data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -1
  288. data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
  289. data/webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js +1 -1
  290. data/webpack/redux/reducers/index.js +2 -0
  291. data/webpack/scenes/AnsibleCollections/AnsibleCollectionsActions.js +1 -1
  292. data/webpack/scenes/AnsibleCollections/AnsibleCollectionsTableSchema.js +1 -1
  293. data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionDetailsActions.js +1 -1
  294. data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetailsActions.test.js +2 -2
  295. data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsTable.test.js +1 -1
  296. data/webpack/scenes/ContentViews/ContentViewSelectors.js +1 -2
  297. data/webpack/scenes/ContentViews/ContentViewsActions.js +4 -4
  298. data/webpack/scenes/ContentViews/ContentViewsConstants.js +4 -1
  299. data/webpack/scenes/ContentViews/ContentViewsPage.js +12 -6
  300. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +44 -0
  301. data/webpack/scenes/ContentViews/Details/ContentViewDetailReducer.js +23 -0
  302. data/webpack/scenes/ContentViews/{details → Details}/ContentViewDetailSelectors.js +3 -0
  303. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +70 -0
  304. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +116 -0
  305. data/webpack/scenes/ContentViews/{details → Details}/DetailsContainer.js +8 -4
  306. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +101 -0
  307. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetails.fixtures.json +106 -0
  308. data/webpack/scenes/ContentViews/Details/contentViewInfo.scss +8 -0
  309. data/webpack/scenes/ContentViews/Details/index.js +7 -0
  310. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +51 -36
  311. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +47 -44
  312. data/webpack/scenes/ContentViews/__tests__/basicContentViews.fixtures.js +31 -0
  313. data/webpack/scenes/ContentViews/__tests__/contentViewList.fixtures.json +2 -1
  314. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +173 -23
  315. data/webpack/scenes/ContentViews/components/ContentViewIcon.js +26 -0
  316. data/webpack/scenes/ContentViews/components/{contentViewName.scss → contentViewIcon.scss} +0 -0
  317. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetailsActions.js +1 -1
  318. data/webpack/scenes/ModuleStreams/Details/Profiles/TableSchema.js +1 -1
  319. data/webpack/scenes/ModuleStreams/Details/__tests__/ModuleStreamDetailsActions.test.js +2 -2
  320. data/webpack/scenes/ModuleStreams/ModuleStreamsActions.js +1 -1
  321. data/webpack/scenes/ModuleStreams/ModuleStreamsTableSchema.js +1 -1
  322. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamsTable.test.js +1 -1
  323. data/webpack/scenes/Organizations/OrganizationSelectors.js +14 -0
  324. data/webpack/scenes/Products/ProductActions.js +1 -1
  325. data/webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js +1 -1
  326. data/webpack/scenes/Settings/SettingsConstants.js +3 -0
  327. data/webpack/scenes/Settings/SettingsReducer.js +33 -0
  328. data/webpack/scenes/Settings/SettingsSelectors.js +4 -0
  329. data/webpack/scenes/Settings/index.js +2 -1
  330. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +1 -1
  331. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +1 -1
  332. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +59 -73
  333. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.scss +15 -0
  334. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +43 -1
  335. data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +8 -0
  336. data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js +1 -1
  337. data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +78 -0
  338. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +2 -0
  339. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +56 -1
  340. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +114 -0
  341. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +6 -6
  342. data/webpack/scenes/Subscriptions/Manifest/__tests__/manifest.fixtures.js +36 -0
  343. data/webpack/scenes/Subscriptions/Manifest/index.js +3 -1
  344. data/webpack/scenes/Subscriptions/SubscriptionActions.js +1 -1
  345. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +4 -0
  346. data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +0 -3
  347. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +38 -11
  348. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +30 -18
  349. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +0 -3
  350. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +1 -1
  351. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +2 -2
  352. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +1 -1
  353. data/webpack/scenes/Subscriptions/__tests__/SubscriptionHelpers.test.js +0 -11
  354. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +2 -2
  355. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +4 -4
  356. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +26 -1
  357. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionTypeFormatter.js +2 -2
  358. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +27 -21
  359. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +6 -2
  360. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +2 -2
  361. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionTypeFormatter.test.js.snap +3 -3
  362. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +1 -1
  363. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +28 -3
  364. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +5 -10
  365. data/webpack/scenes/Subscriptions/index.js +6 -2
  366. data/webpack/test-utils/nockWrapper.js +39 -5
  367. data/webpack/test-utils/react-testing-lib-wrapper.js +35 -9
  368. data/webpack/{move_to_foreman/common → utils}/helpers.js +12 -8
  369. data/webpack/utils/useEventListener.js +37 -0
  370. metadata +163 -80
  371. data/vendor/assets/stylesheets/katello/jquery.loadmask.css.scss +0 -40
  372. data/vendor/assets/stylesheets/katello/ui.spinner.css.scss +0 -3
  373. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +0 -2
  374. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalSelectors.js +0 -2
  375. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +0 -4
  376. data/webpack/__mocks__/foremanReact/components/Settings/SettingsActions.js +0 -4
  377. data/webpack/__mocks__/foremanReact/components/Settings/SettingsConstants.js +0 -2
  378. data/webpack/move_to_pf/TypeAhead/TypeAhead.js +0 -138
  379. data/webpack/move_to_pf/TypeAhead/helpers.js +0 -5
  380. data/webpack/scenes/ContentViews/components/ContentViewName.js +0 -33
  381. data/webpack/scenes/ContentViews/components/EmptyStateMessage.js +0 -43
  382. data/webpack/scenes/ContentViews/details/ContentViewDetailActions.js +0 -12
  383. data/webpack/scenes/ContentViews/expansions/RepositoriesExpansion.js +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 590a33ff3016ad29aaeca6e8d5a0c967b9053a01cf3dbf8f28fcb68b63d056bd
4
- data.tar.gz: e8c30ca9e88f472f3aabf89b7f2cc3c6122750706e9bdfbb9d1cfa8aa957d4a5
3
+ metadata.gz: bf008f8880960ad2a6cf9b615c0e0801fb38cce104e67001f4d17178cca43ab7
4
+ data.tar.gz: d2cda17cc4664479ac34f7abd33c08f14ef81f038abb0cfe3d43c9542624c48b
5
5
  SHA512:
6
- metadata.gz: 2fbba71f828db21edacf4100aac226a638fa7c6dd59871f6d0f029846af27ff54914c803798fd6054463ae4f44bbfc29d9466fca8a19867e63c10486668ce30c
7
- data.tar.gz: 17347500daf6bb1b2dd1ff7126b97e84f2120e1c12e23066036d2f30402cdb9018dc5c6cb1f74ceff441f069a2733dceb4e3a4958032237034eaff5783915b49
6
+ metadata.gz: 27f052edff77986139ef6a82d0cd318c95b90a601a9f42178038896589c1042b1e18d030320173ae2c5a21ac75bfe09b13e7376525574f7dbff9d33b4867b8fa
7
+ data.tar.gz: 22f05c56710ee8951e1d15d30e5b2d471ab07f17287c51c01b7958e751442197fe89b8d262eb89584e612bba939aad7e8d7ddd407d55937d31a04d00e1df8e10
@@ -1,10 +1,3 @@
1
- /**
2
- * = require "katello/jquery.loadmask.css"
3
- * = require "katello/jquery-ui-1.8.11.custom.css"
4
- * = require "katello/jquery.treeTable.css"
5
- * = require "katello/ui.spinner.css"
6
- */
7
-
8
1
  @import "katello/overrides";
9
2
  @import "katello/katello_base";
10
3
  @import "katello/look";
@@ -18,6 +11,9 @@
18
11
  @import "katello/generic";
19
12
  @import "katello/notifications";
20
13
 
14
+ @import "katello/jquery.treeTable";
15
+ @import "katello/jquery-ui-1.8.11.custom.css";
16
+
21
17
  body {
22
18
  background-color: white;
23
19
  }
@@ -6,8 +6,8 @@ module Katello
6
6
  before_action :confirm_push_settings, only: [:start_upload_blob, :upload_blob, :finish_upload_blob,
7
7
  :chunk_upload_blob, :push_manifest]
8
8
  skip_before_action :authorize
9
- before_action :optional_authorize, only: [:token]
10
- before_action :registry_authorize, except: [:token, :v1_search]
9
+ before_action :optional_authorize, only: [:token, :catalog]
10
+ before_action :registry_authorize, except: [:token, :v1_search, :catalog]
11
11
  before_action :authorize_repository_read, only: [:pull_manifest, :tags_list]
12
12
  before_action :authorize_repository_write, only: [:push_manifest]
13
13
  skip_before_action :check_content_type, only: [:start_upload_blob, :upload_blob, :finish_upload_blob,
@@ -39,20 +39,7 @@ module Katello
39
39
  "scope=\"repository:registry:pull,push\""
40
40
  end
41
41
 
42
- def optional_authorize
43
- @repository = find_scope_repository
44
- if @repository && (@repository.environment.registry_unauthenticated_pull || ssl_client_authorized?(@repository.organization.label))
45
- true
46
- else
47
- authorize
48
- end
49
- end
50
-
51
- def registry_authorize
52
- @repository = find_readable_repository
53
- return true if ['GET', 'HEAD'].include?(request.method) && @repository && !require_user_authorization?
54
-
55
- token = request.headers['Authorization']
42
+ def set_user_by_token(token, redirect_on_failure = true)
56
43
  if token
57
44
  token_type, token = token.split
58
45
  if token_type == 'Bearer' && token
@@ -63,10 +50,34 @@ module Katello
63
50
  end
64
51
  elsif token_type == 'Basic' && token
65
52
  return true if authorize
66
- redirect_authorization_headers
53
+ redirect_authorization_headers if redirect_on_failure
67
54
  return false
68
55
  end
69
56
  end
57
+ false
58
+ end
59
+
60
+ def optional_authorize
61
+ @repository = find_scope_repository
62
+ if @repository && (@repository.environment.registry_unauthenticated_pull || ssl_client_authorized?(@repository.organization.label))
63
+ true
64
+ elsif params['action'] == 'catalog'
65
+ set_user_by_token(request.headers['Authorization'], false)
66
+ elsif (params['action'] == 'token' && params['scope'].blank? && params['account'].blank?)
67
+ true
68
+ else
69
+ authorize
70
+ end
71
+ end
72
+
73
+ def registry_authorize
74
+ @repository = find_readable_repository
75
+ return true if ['GET', 'HEAD'].include?(request.method) && @repository && !require_user_authorization?
76
+
77
+ is_user_set = set_user_by_token(request.headers['Authorization'])
78
+
79
+ return true if is_user_set
80
+
70
81
  redirect_authorization_headers
71
82
  render_error('unauthorized', :status => :unauthorized)
72
83
  return false
@@ -87,12 +98,8 @@ module Katello
87
98
  # Also include repositories in lifecycle environments with registry_unauthenticated_pull=true
88
99
  def readable_repositories
89
100
  table_name = Repository.table_name
90
- in_products = Repository.in_product(Katello::Product.authorized(:view_products)).select(:id)
91
- in_environments = Repository.where(:environment_id => Katello::KTEnvironment.authorized(:view_lifecycle_environments)).select(:id)
92
101
  in_unauth_environments = Repository.joins(:environment).where("#{Katello::KTEnvironment.table_name}.registry_unauthenticated_pull" => true).select(:id)
93
- in_content_views = Repository.joins(:content_view_repositories).where("#{ContentViewRepository.table_name}.content_view_id" => Katello::ContentView.readable).select(:id)
94
- in_versions = Repository.joins(:content_view_version).where("#{Katello::ContentViewVersion.table_name}.content_view_id" => Katello::ContentView.readable).select(:id)
95
- Repository.where("#{table_name}.id in (?) or #{table_name}.id in (?) or #{table_name}.id in (?) or #{table_name}.id in (?) or #{table_name}.id in (?)", in_products, in_content_views, in_versions, in_environments, in_unauth_environments)
102
+ Repository.readable.or(Repository.joins(:root).where("#{table_name}.id in (?)", in_unauth_environments))
96
103
  end
97
104
 
98
105
  def find_readable_repository
@@ -105,7 +112,8 @@ module Katello
105
112
  end
106
113
 
107
114
  def require_user_authorization?(repository = @repository)
108
- !repository || (!repository.environment.registry_unauthenticated_pull && !ssl_client_authorized?(repository.organization.label))
115
+ !(params['action'] == 'token' && params['scope'].blank? && params['account'].blank?) &&
116
+ (!repository || (!repository.environment.registry_unauthenticated_pull && !ssl_client_authorized?(repository.organization.label)))
109
117
  end
110
118
 
111
119
  def ssl_client_authorized?(org_label)
@@ -293,6 +301,14 @@ module Katello
293
301
  end
294
302
 
295
303
  def v1_search
304
+ # Checks for podman client and issues a 404 in that case. Podman
305
+ # examines the response from a /v1_search request. If the result
306
+ # is a 4XX, it will then proceed with a request to /_catalog
307
+ if request.headers['HTTP_USER_AGENT'].downcase.include?('libpod')
308
+ render json: {}, status: :not_found
309
+ return
310
+ end
311
+
296
312
  authenticate # to set current_user, not to enforce
297
313
  options = {
298
314
  resource_class: Katello::Repository
@@ -268,8 +268,8 @@ module Katello
268
268
  end
269
269
 
270
270
  def get_parent_host(headers)
271
- hostnames = headers["HTTP_X_FORWARDED_SERVER"]
272
- host = hostnames.split(",")[0] if hostnames
271
+ hostnames = headers["HTTP_X_FORWARDED_HOST"]
272
+ host = hostnames.split(/[\,,:]/)[0].strip if hostnames
273
273
  host || URI.parse(Setting[:foreman_url]).host
274
274
  end
275
275
 
@@ -1,4 +1,5 @@
1
1
  module Katello
2
+ # rubocop:disable Metrics/ClassLength
2
3
  class Api::V2::ActivationKeysController < Api::V2::ApiController
3
4
  include Katello::Concerns::FilteredAutoCompleteSearch
4
5
  include Katello::Concerns::Api::V2::ContentOverridesController
@@ -11,6 +12,7 @@ module Katello
11
12
  :content_override, :add_subscriptions, :remove_subscriptions,
12
13
  :subscriptions]
13
14
  before_action :authorize
15
+ before_action :verify_simple_content_access_disabled, :only => [:add_subscriptions]
14
16
 
15
17
  wrap_parameters :include => (ActivationKey.attribute_names + %w(host_collection_ids service_level auto_attach purpose_role purpose_usage purpose_addons content_view_environment))
16
18
 
@@ -348,5 +350,11 @@ module Katello
348
350
 
349
351
  key_params
350
352
  end
353
+
354
+ def verify_simple_content_access_disabled
355
+ if @activation_key.organization.simple_content_access?
356
+ fail HttpErrors::BadRequest, _("The specified organization is in Simple Content Access mode. Attaching subscriptions is disabled")
357
+ end
358
+ end
351
359
  end
352
360
  end
@@ -5,6 +5,7 @@ module Katello
5
5
  include Api::V2::Rendering
6
6
  include Api::V2::ErrorHandling
7
7
  include ::Foreman::Controller::CsvResponder
8
+ include Concerns::Api::V2::AssociationsPermissionCheck
8
9
 
9
10
  # support for session (thread-local) variables must be the last filter in this class
10
11
  include Foreman::ThreadSession::Cleaner
@@ -37,6 +37,8 @@ module Katello
37
37
  param :type, String, :desc => N_("type of filter (e.g. rpm, package_group, erratum, docker, modulemd)"), :required => true
38
38
  param :original_packages, :bool, :desc => N_("add all packages without errata to the included/excluded list. " \
39
39
  "(package filter only)")
40
+ param :original_module_streams, :bool, :desc => N_("add all module streams without errata to the included/excluded list. " \
41
+ "(module stream filter only)")
40
42
  param :inclusion, :bool, :desc => N_("specifies if content should be included or excluded, default: inclusion=false")
41
43
  param :repository_ids, Array, :desc => N_("list of repository ids")
42
44
  param :description, String, :desc => N_("description of the filter")
@@ -60,6 +62,8 @@ module Katello
60
62
  param :name, String, :desc => N_("new name for the filter")
61
63
  param :original_packages, :bool, :desc => N_("add all packages without errata to the included/excluded list. " \
62
64
  "(package filter only)")
65
+ param :original_module_streams, :bool, :desc => N_("add all module streams without errata to the included/excluded list. " \
66
+ "(module stream filter only)")
63
67
  param :inclusion, :bool, :desc => N_("specifies if content should be included or excluded, default: inclusion=false")
64
68
  param :repository_ids, Array, :desc => N_("list of repository ids")
65
69
  param :description, String, :desc => N_("description of the filter"), :required => false
@@ -95,7 +99,7 @@ module Katello
95
99
  end
96
100
 
97
101
  def filter_params
98
- params.require(:content_view_filter).permit(:name, :inclusion, :original_packages, :description, :repository_ids => [])
102
+ params.require(:content_view_filter).permit(:name, :inclusion, :original_packages, :original_module_streams, :description, :repository_ids => [])
99
103
  end
100
104
  end
101
105
  end
@@ -143,6 +143,9 @@ module Katello
143
143
  end
144
144
  end
145
145
  def incremental_update
146
+ if params[:add_content].values.flatten.empty?
147
+ fail HttpErrors::BadRequest, _("Incremental update requires at least one content unit")
148
+ end
146
149
  any_environments = params[:content_view_version_environments].any? { |cvve| cvve[:environment_ids].try(:any?) }
147
150
  if params[:add_content]&.key?(:errata_ids) && params[:update_hosts] && any_environments
148
151
  hosts = calculate_hosts_for_incremental(params[:update_hosts], params[:propagate_to_composites])
@@ -22,6 +22,13 @@ module Katello
22
22
  param :solve_dependencies, :bool, :desc => N_("Solve RPM dependencies by default on Content View publish, defaults to false")
23
23
  end
24
24
 
25
+ def filtered_associations
26
+ {
27
+ :component_ids => Katello::ContentViewVersion,
28
+ :repository_ids => Katello::Repository
29
+ }
30
+ end
31
+
25
32
  api :GET, "/organizations/:organization_id/content_views", N_("List content views")
26
33
  api :GET, "/content_views", N_("List content views")
27
34
  param :organization_id, :number, :desc => N_("organization identifier")
@@ -39,7 +39,9 @@ module Katello
39
39
  respond_for_index :collection => @collection
40
40
  end
41
41
 
42
- def index_response
42
+ def index_response(reload_host = false)
43
+ # Host needs to be reloaded because of lazy accessor
44
+ @host.reload if reload_host
43
45
  entitlements = @host.subscription_facet.candlepin_consumer.entitlements
44
46
  subscriptions = entitlements.map { |entitlement| ::Katello::HostSubscriptionPresenter.new(entitlement) }
45
47
  full_result_response(subscriptions)
@@ -53,7 +55,7 @@ module Katello
53
55
  end
54
56
 
55
57
  sync_task(::Actions::Katello::Host::AutoAttachSubscriptions, @host)
56
- respond_for_index(:collection => index_response, :template => "index")
58
+ respond_for_index(:collection => index_response(true), :template => "index")
57
59
  end
58
60
 
59
61
  api :DELETE, "/hosts/:host_id/subscriptions/", N_("Unregister the host as a subscription consumer")
@@ -124,7 +126,7 @@ module Katello
124
126
  end
125
127
 
126
128
  sync_task(::Actions::Katello::Host::RemoveSubscriptions, @host, pool_id_quantities.values)
127
- respond_for_index(:collection => index_response, :template => "index")
129
+ respond_for_index(:collection => index_response(true), :template => "index")
128
130
  end
129
131
 
130
132
  api :PUT, "/hosts/:host_id/subscriptions/add_subscriptions", N_("Add a subscription to a host")
@@ -134,12 +136,16 @@ module Katello
134
136
  param :quantity, :number, :desc => N_("Quantity of this subscriptions to add"), :required => true
135
137
  end
136
138
  def add_subscriptions
139
+ if @host.organization.simple_content_access?
140
+ fail ::Katello::HttpErrors::BadRequest, _("This host's organization is in Simple Content Access mode. Attaching subscriptions is disabled.")
141
+ end
142
+
137
143
  pools_with_quantities = params.require(:subscriptions).map do |sub_params|
138
144
  PoolWithQuantities.new(Pool.with_identifier(sub_params['id']), sub_params['quantity'].to_i)
139
145
  end
140
146
 
141
147
  sync_task(::Actions::Katello::Host::AttachSubscriptions, @host, pools_with_quantities)
142
- respond_for_index(:collection => index_response, :template => "index")
148
+ respond_for_index(:collection => index_response(true), :template => "index")
143
149
  end
144
150
 
145
151
  api :PUT, "/hosts/:host_id/subscriptions/content_override", N_("Set content overrides for the host")
@@ -10,9 +10,11 @@ module Katello
10
10
  before_action :find_deletable_hosts, :only => [:destroy_hosts]
11
11
  before_action :find_readable_hosts, :only => [:applicable_errata, :installable_errata, :available_incremental_updates]
12
12
  before_action :find_errata, :only => [:available_incremental_updates]
13
+ before_action :find_organization, :only => [:add_subscriptions]
13
14
  before_action :deprecate_katello_agent, :only => [:install_content, :update_content, :remove_content]
14
15
 
15
16
  before_action :validate_content_action, :only => [:install_content, :update_content, :remove_content]
17
+ before_action :validate_organization, :only => [:add_subscriptions]
16
18
 
17
19
  # disable *_count fields on erratum rabl, since they perform N+1 queries
18
20
  before_action :disable_erratum_hosts_count
@@ -173,6 +175,10 @@ module Katello
173
175
  param :quantity, :number, :desc => N_("Quantity of this subscriptions to add"), :required => true
174
176
  end
175
177
  def add_subscriptions
178
+ if @organization.simple_content_access?
179
+ fail HttpErrors::BadRequest, _("The specified organization is in Simple Content Access mode. Attaching subscriptions is disabled")
180
+ end
181
+
176
182
  pools_with_quantities = params.require(:subscriptions).map do |sub_params|
177
183
  PoolWithQuantities.new(Pool.find(sub_params['id']), sub_params['quantity'])
178
184
  end
@@ -295,6 +301,10 @@ module Katello
295
301
  find_bulk_hosts(:destroy_hosts, params)
296
302
  end
297
303
 
304
+ def validate_organization
305
+ fail HttpErrors::BadRequest, _("Organization ID is required") if @organization.blank?
306
+ end
307
+
298
308
  def validate_host_collection_membership_limit
299
309
  max_hosts_exceeded = []
300
310
  host_ids = @hosts.map(&:id)
@@ -57,6 +57,7 @@ module Katello
57
57
  param :ansible_collection_requirements, String, :desc => N_("Contents of requirement yaml file to sync from URL")
58
58
  param :http_proxy_policy, ::Katello::RootRepository::HTTP_PROXY_POLICIES, :desc => N_("policies for HTTP proxy for content sync")
59
59
  param :http_proxy_id, :number, :desc => N_("ID of a HTTP Proxy")
60
+ param :auto_enabled, :bool, :desc => N_("if true, the repositories will be automatically enabled on a registered host subscribed to this product. Default: true")
60
61
  end
61
62
 
62
63
  def_param_group :repo_create do
@@ -327,6 +328,7 @@ module Katello
327
328
  api :PUT, "/repositories/:id", N_("Update a repository")
328
329
  param :id, :number, :required => true, :desc => N_("repository ID")
329
330
  param :name, String, :required => false
331
+ param :description, String, :desc => N_("description of the repository"), :required => false
330
332
  param_group :repo
331
333
  def update
332
334
  repo_params = repository_params
@@ -463,7 +465,7 @@ module Katello
463
465
 
464
466
  def repository_params
465
467
  keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password, :upstream_username,
466
- :ostree_upstream_sync_depth, :ostree_upstream_sync_policy,
468
+ :ostree_upstream_sync_depth, :ostree_upstream_sync_policy, :auto_enabled,
467
469
  :deb_releases, :deb_components, :deb_architectures, :description, :http_proxy_policy, :http_proxy_id,
468
470
  {:ignorable_content => []}
469
471
  ]
@@ -514,6 +516,7 @@ module Katello
514
516
  root.ansible_collection_requirements = repo_params[:ansible_collection_requirements] if root.ansible_collection?
515
517
  root.http_proxy_policy = repo_params[:http_proxy_policy] if repo_params.key?(:http_proxy_policy)
516
518
  root.http_proxy_id = repo_params[:http_proxy_id] if repo_params.key?(:http_proxy_id)
519
+ root.auto_enabled = repo_params[:auto_enabled] if repo_params.key?(:auto_enabled)
517
520
 
518
521
  if root.ostree?
519
522
  root.ostree_upstream_sync_policy = repo_params[:ostree_upstream_sync_policy]
@@ -77,6 +77,22 @@ module Katello
77
77
  render json: { status: 'OK' }
78
78
  end
79
79
 
80
+ api :PUT, "/organizations/:organization_id/simple_content_access/enable",
81
+ N_("Enable simple content access for a manifest")
82
+ param :organization_id, :number, :desc => N_("Organization ID"), :required => true
83
+ def enable_simple_content_access
84
+ task = async_task(::Actions::Katello::Organization::SimpleContentAccess::Enable, params[:organization_id])
85
+ respond_for_async :resource => task
86
+ end
87
+
88
+ api :PUT, "/organizations/:organization_id/simple_content_access/disable",
89
+ N_("Disable simple content access for a manifest")
90
+ param :organization_id, :number, :desc => N_("Organization ID"), :required => true
91
+ def disable_simple_content_access
92
+ task = async_task(::Actions::Katello::Organization::SimpleContentAccess::Disable, params[:organization_id])
93
+ respond_for_async :resource => task
94
+ end
95
+
80
96
  private
81
97
 
82
98
  def update_params
@@ -0,0 +1,67 @@
1
+ module Katello
2
+ module Concerns
3
+ module Api::V2::AssociationsPermissionCheck
4
+ extend ActiveSupport::Concern
5
+
6
+ # The purpose of this module is to protect a controller from a user creating or updating some association
7
+ # when they do not have permissions to view the associated items. An example would be adding random repository ids to
8
+ # content view.
9
+ # To support this, within the controller define a method such as:
10
+ # def filtered_associations
11
+ # {
12
+ # :component_ids => Katello::ContentViewVersion,
13
+ # :repository_ids => Katello::Repository
14
+ # }
15
+ # end
16
+ # This assumes that the parameters are 'wrapped'. So the above in the content_views_controller, actually looks at
17
+ # a subhash of 'content_view'
18
+
19
+ included do
20
+ before_action :check_association_ids, :only => [:create, :update]
21
+ end
22
+
23
+ def check_association_ids
24
+ if filtered_associations
25
+ wrapped_params = params[self._wrapper_options.name]
26
+ find_param_arrays(wrapped_params).each do |key_path|
27
+ if (model_class = filtered_associations.with_indifferent_access.dig(*key_path))
28
+ param_ids = wrapped_params.dig(*key_path)
29
+ filtered_ids = model_class.readable.where(:id => param_ids).pluck(:id)
30
+ if (unfound_ids = param_ids_missing(param_ids, filtered_ids)).any?
31
+ fail HttpErrors::NotFound, _("One or more ids (%{ids}) were not found for %{assoc}. You may not have permissions to see them.") %
32
+ {ids: unfound_ids, assoc: key_path.last}
33
+ end
34
+ else
35
+ fail _("Unfiltered params array: %s.") % key_path
36
+ end
37
+ end
38
+ else
39
+ Rails.logger.warn("#{self.class.name} may has unprotected associations, see associations_permission_check.rb for details.") if ENV['RAILS_ENV'] == 'development'
40
+ end
41
+ end
42
+
43
+ def filtered_associations
44
+ #should return {} when supported by all controllers
45
+ nil
46
+ end
47
+
48
+ def param_ids_missing(param_ids, filtered_ids)
49
+ param_ids.map(&:to_i).uniq - filtered_ids.map(&:to_i).uniq
50
+ end
51
+
52
+ #returns an array of list of keys pointing to an array in a params hash i.e.:
53
+ # {"a"=> {"b" => [3]}} => [["a", "b"]]
54
+ def find_param_arrays(hash = params)
55
+ list_of_paths = []
56
+ hash.each do |key, value|
57
+ if value.is_a?(ActionController::Parameters) || value.is_a?(Hash)
58
+ list_of_paths += find_param_arrays(value).compact.map { |inner_keys| [key] + inner_keys }
59
+ elsif value.is_a?(Array)
60
+ list_of_paths << [key]
61
+ end
62
+ end
63
+ list_of_paths.compact
64
+ end
65
+ end
66
+ end
67
+ end
@@ -5,19 +5,19 @@ module Katello
5
5
 
6
6
  def find_bulk_hosts(permission, bulk_params, restrict_to = nil)
7
7
  #works on a structure of param_group bulk_params and transforms it into a list of systems
8
- organization = find_organization
8
+ find_organization
9
9
  bulk_params[:included] ||= {}
10
10
  bulk_params[:excluded] ||= {}
11
11
  @hosts = []
12
12
 
13
13
  unless bulk_params[:included][:ids].blank?
14
14
  @hosts = ::Host::Managed.authorized(permission).where(:id => bulk_params[:included][:ids])
15
- @hosts = @hosts.where(:organization_id => organization.id) if organization
15
+ @hosts = @hosts.where(:organization_id => @organization.id) if @organization
16
16
  end
17
17
 
18
18
  if bulk_params[:included][:search]
19
19
  search_hosts = ::Host::Managed.authorized(permission)
20
- search_hosts = search_hosts.where(:organization_id => organization_id) if params[:organization_id]
20
+ search_hosts = search_hosts.where(:organization_id => @organization.id) if @organization
21
21
  search_hosts = search_hosts.search_for(bulk_params[:included][:search])
22
22
  if @hosts.any?
23
23
  @hosts = ::Host.where(id: @hosts).or(::Host.where(id: search_hosts))
@@ -38,7 +38,7 @@ module Katello
38
38
  end
39
39
 
40
40
  def find_organization
41
- Organization.find_by_id(params[:organization_id])
41
+ @organization ||= Organization.find_by_id(params[:organization_id])
42
42
  end
43
43
  end
44
44
  end