katello 3.17.3 → 3.18.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +38 -21
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -1
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +10 -15
  5. data/app/controllers/katello/api/v2/api_controller.rb +2 -1
  6. data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -8
  7. data/app/controllers/katello/api/v2/content_view_components_controller.rb +31 -14
  8. data/app/controllers/katello/api/v2/content_view_repositories_controller.rb +1 -0
  9. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +65 -36
  10. data/app/controllers/katello/api/v2/content_views_controller.rb +27 -25
  11. data/app/controllers/katello/api/v2/environments_controller.rb +8 -8
  12. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +5 -5
  13. data/app/controllers/katello/api/v2/host_collections_controller.rb +19 -16
  14. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +17 -0
  15. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +1 -1
  16. data/app/controllers/katello/api/v2/repositories_controller.rb +8 -5
  17. data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
  18. data/app/controllers/katello/api/v2/sync_plans_controller.rb +8 -9
  19. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +9 -2
  20. data/app/controllers/katello/concerns/api/v2/authorization.rb +9 -5
  21. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +21 -0
  22. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +1 -1
  23. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +2 -1
  24. data/app/helpers/katello/katello_urls_helper.rb +5 -2
  25. data/app/lib/actions/candlepin/product/content_create.rb +2 -0
  26. data/app/lib/actions/candlepin/product/content_update.rb +2 -0
  27. data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +2 -6
  28. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +2 -6
  29. data/app/lib/actions/katello/content_view/publish.rb +3 -4
  30. data/app/lib/actions/katello/content_view_version/import.rb +4 -3
  31. data/app/lib/actions/katello/content_view_version/incremental_update.rb +18 -3
  32. data/app/lib/actions/katello/host/update_system_purpose.rb +31 -0
  33. data/app/lib/actions/katello/organization/manifest_delete.rb +0 -1
  34. data/app/lib/actions/katello/organization/manifest_import.rb +0 -1
  35. data/app/lib/actions/katello/organization/manifest_refresh.rb +0 -1
  36. data/app/lib/actions/katello/product/content_create.rb +7 -6
  37. data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -1
  38. data/app/lib/actions/katello/repository/import_upload.rb +2 -1
  39. data/app/lib/actions/katello/repository/update.rb +4 -1
  40. data/app/lib/actions/pulp3/abstract_async_task.rb +0 -1
  41. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
  42. data/app/lib/actions/pulp3/content_view_version/create_importer.rb +7 -3
  43. data/app/lib/actions/pulp3/content_view_version/export.rb +2 -1
  44. data/app/lib/actions/pulp3/content_view_version/import.rb +7 -3
  45. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +15 -10
  46. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +16 -10
  47. data/app/lib/actions/pulp3/repository/commit_upload.rb +2 -1
  48. data/app/lib/actions/pulp3/repository/delete.rb +1 -1
  49. data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -1
  50. data/app/lib/katello/resources/candlepin/consumer.rb +2 -2
  51. data/app/lib/katello/resources/candlepin/owner.rb +5 -0
  52. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
  53. data/app/lib/katello/resources/registry.rb +3 -3
  54. data/app/models/katello/authorization/activation_key.rb +4 -0
  55. data/app/models/katello/authorization/content_view.rb +13 -0
  56. data/app/models/katello/authorization/content_view_component.rb +15 -0
  57. data/app/models/katello/authorization/gpg_key.rb +12 -4
  58. data/app/models/katello/authorization/lifecycle_environment.rb +8 -0
  59. data/app/models/katello/authorization/sync_plan.rb +16 -0
  60. data/app/models/katello/concerns/organization_extensions.rb +4 -5
  61. data/app/models/katello/concerns/redhat_extensions.rb +2 -2
  62. data/app/models/katello/concerns/smart_proxy_extensions.rb +1 -3
  63. data/app/models/katello/content_view_component.rb +2 -0
  64. data/app/models/katello/content_view_version_export_history.rb +2 -0
  65. data/app/models/katello/glue/candlepin/pool.rb +9 -14
  66. data/app/models/katello/glue/pulp/repo.rb +8 -0
  67. data/app/models/katello/gpg_key.rb +1 -1
  68. data/app/models/katello/root_repository.rb +26 -1
  69. data/app/services/katello/applicability/applicable_content_helper.rb +1 -12
  70. data/app/services/katello/candlepin/event_handler.rb +2 -0
  71. data/app/services/katello/candlepin/message_handler.rb +34 -0
  72. data/app/services/katello/candlepin/upstream_consumer.rb +28 -0
  73. data/app/services/katello/host_status_manager.rb +9 -0
  74. data/app/services/katello/pulp3/api/apt.rb +57 -0
  75. data/app/services/katello/pulp3/api/core.rb +8 -0
  76. data/app/services/katello/pulp3/content_view_version/export.rb +4 -3
  77. data/app/services/katello/pulp3/content_view_version/import.rb +5 -15
  78. data/app/services/katello/pulp3/deb.rb +38 -0
  79. data/app/services/katello/pulp3/erratum.rb +1 -2
  80. data/app/services/katello/pulp3/pulp_content_unit.rb +5 -0
  81. data/app/services/katello/pulp3/repository/ansible_collection.rb +9 -0
  82. data/app/services/katello/pulp3/repository/apt.rb +63 -0
  83. data/app/services/katello/pulp3/repository/docker.rb +4 -0
  84. data/app/services/katello/pulp3/repository/yum.rb +2 -1
  85. data/app/services/katello/pulp3/repository.rb +11 -9
  86. data/app/services/katello/pulp3/repository_mirror.rb +9 -4
  87. data/app/services/katello/pulp3/task.rb +3 -3
  88. data/app/services/katello/pulp3/task_group.rb +0 -6
  89. data/app/views/dashboard/_subscription_widget.html.erb +0 -5
  90. data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -1
  91. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
  92. data/app/views/overrides/organizations/_index_row_override.html.erb +1 -1
  93. data/config/routes/api/v2.rb +2 -0
  94. data/config/routes/overrides.rb +1 -0
  95. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  96. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +2 -5
  97. data/db/migrate/20201008204114_add_os_versions_to_katello_root_repositories.rb +5 -0
  98. data/db/migrate/20201012172713_remove_gpg_key_perms.rb +23 -0
  99. data/db/migrate/20201012192035_add_metadata_to_katello_content_view_version_export_history.rb +5 -0
  100. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  101. data/engines/bastion/app/assets/javascripts/bastion/components/notification.service.js +1 -1
  102. data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +8 -13
  103. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +1 -1
  104. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js +112 -0
  105. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +78 -0
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +2 -42
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +11 -0
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +5 -0
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +4 -0
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +1 -1
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +4 -0
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +6 -0
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +16 -14
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +6 -7
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +168 -155
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +17 -2
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +125 -113
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +15 -3
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +46 -0
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +1 -1
  123. data/lib/katello/engine.rb +1 -0
  124. data/lib/katello/permission_creator.rb +68 -59
  125. data/lib/katello/permissions/host_permissions.rb +1 -0
  126. data/lib/katello/plugin.rb +4 -1
  127. data/lib/katello/repository_types/deb.rb +9 -1
  128. data/lib/katello/tasks/pulp3_content_switchover.rake +1 -3
  129. data/lib/katello/tasks/pulp3_migration_stats.rake +21 -0
  130. data/lib/katello/tasks/reports.rake +1 -4
  131. data/lib/katello/tasks/reset.rake +2 -1
  132. data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +18 -0
  133. data/lib/katello/version.rb +1 -1
  134. data/locale/action_names.rb +54 -47
  135. data/locale/bn/katello.po +165 -26
  136. data/locale/cs/katello.po +164 -24
  137. data/locale/de/katello.po +165 -26
  138. data/locale/en/katello.po +164 -23
  139. data/locale/es/katello.po +165 -25
  140. data/locale/fr/katello.po +165 -25
  141. data/locale/gu/katello.po +165 -26
  142. data/locale/hi/katello.po +165 -26
  143. data/locale/it/katello.po +165 -25
  144. data/locale/ja/katello.po +165 -26
  145. data/locale/katello.pot +1036 -802
  146. data/locale/kn/katello.po +165 -26
  147. data/locale/ko/katello.po +165 -25
  148. data/locale/mr/katello.po +165 -26
  149. data/locale/or/katello.po +165 -26
  150. data/locale/pa/katello.po +165 -26
  151. data/locale/pt/katello.po +164 -23
  152. data/locale/pt_BR/katello.po +165 -25
  153. data/locale/ru/katello.po +165 -25
  154. data/locale/ta/katello.po +165 -26
  155. data/locale/te/katello.po +165 -26
  156. data/locale/zh_CN/katello.po +165 -25
  157. data/locale/zh_TW/katello.po +165 -26
  158. data/webpack/components/ActionableDetail.js +2 -1
  159. data/webpack/components/Search/Search.js +1 -1
  160. data/webpack/components/Table/MainTable.js +6 -2
  161. data/webpack/components/Table/TableWrapper.js +46 -9
  162. data/webpack/scenes/ContentViews/ContentViewSelectors.js +7 -3
  163. data/webpack/scenes/ContentViews/ContentViewsConstants.js +8 -0
  164. data/webpack/scenes/ContentViews/ContentViewsPage.js +2 -9
  165. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +25 -3
  166. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +14 -4
  167. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
  168. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +56 -0
  169. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +169 -0
  170. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +47 -0
  171. data/webpack/scenes/ContentViews/Details/Repositories/RepoAddedStatus.js +17 -0
  172. data/webpack/scenes/ContentViews/Details/Repositories/RepoIcon.js +23 -0
  173. data/webpack/scenes/ContentViews/Details/Repositories/SelectableDropdown.js +49 -0
  174. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +154 -0
  175. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +131 -0
  176. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
  177. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +4 -1
  178. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
  179. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +16 -8
  180. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +17 -0
  181. data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +4 -0
  182. data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +19 -2
  183. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +9 -1
  184. data/webpack/scenes/Subscriptions/Manifest/index.js +2 -1
  185. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +1 -1
  186. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +3 -0
  187. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +8 -2
  188. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +3 -0
  189. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +3 -0
  190. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +6 -0
  191. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +6 -0
  192. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -13
  193. metadata +69 -26
@@ -17,6 +17,7 @@
17
17
  * @requires OstreeUpstreamSyncPolicy
18
18
  * @requires Architecture
19
19
  * @requires RepositoryTypesService
20
+ * @requires OSVersions
20
21
  * @requires YumContentUnits
21
22
  * #requires HttpProxyPolicy
22
23
  *
@@ -24,118 +25,121 @@
24
25
  * Controls the creation of an empty Repository object for use by sub-controllers.
25
26
  */
26
27
  angular.module('Bastion.repositories').controller('NewRepositoryController',
27
- ['$scope', '$sce', 'Repository', 'Product', 'ContentCredential', 'FormUtils', 'translate', 'Notification', 'ApiErrorHandler', 'BastionConfig', 'Checksum', 'YumContentUnits', 'DownloadPolicy', 'OstreeUpstreamSyncPolicy', 'Architecture', 'RepositoryTypesService', 'HttpProxy', 'HttpProxyPolicy',
28
- function ($scope, $sce, Repository, Product, ContentCredential, FormUtils, translate, Notification, ApiErrorHandler, BastionConfig, Checksum, YumContentUnits, DownloadPolicy, OstreeUpstreamSyncPolicy, Architecture, RepositoryTypesService, HttpProxy, HttpProxyPolicy) {
29
-
30
- function success() {
31
- Notification.setSuccessMessage(translate('Repository %s successfully created.').replace('%s', $scope.repository.name));
32
- $scope.transitionTo('product.repositories', {productId: $scope.$stateParams.productId});
33
- }
34
-
35
- function error(response) {
36
- var foundError = false;
37
- $scope.working = false;
38
-
39
- angular.forEach($scope.repositoryForm, function (field) {
40
- if ($scope.repositoryForm.hasOwnProperty(field) && field.hasOwnProperty('$modelValue')) {
41
- field.$setValidity('server', true);
42
- $scope.repositoryForm[field].$error.messages = [];
28
+ ['$scope', '$sce', 'Repository', 'Product', 'ContentCredential', 'FormUtils', 'translate', 'Notification', 'ApiErrorHandler', 'BastionConfig', 'Checksum', 'YumContentUnits', 'DownloadPolicy', 'OstreeUpstreamSyncPolicy', 'Architecture', 'RepositoryTypesService', 'HttpProxy', 'HttpProxyPolicy', 'OSVersions',
29
+ function ($scope, $sce, Repository, Product, ContentCredential, FormUtils, translate, Notification, ApiErrorHandler, BastionConfig, Checksum, YumContentUnits, DownloadPolicy, OstreeUpstreamSyncPolicy, Architecture, RepositoryTypesService, HttpProxy, HttpProxyPolicy, OSVersions) {
30
+
31
+ function success() {
32
+ Notification.setSuccessMessage(translate('Repository %s successfully created.').replace('%s', $scope.repository.name));
33
+ $scope.transitionTo('product.repositories', {productId: $scope.$stateParams.productId});
34
+ }
35
+
36
+ function error(response) {
37
+ var foundError = false;
38
+ $scope.working = false;
39
+
40
+ angular.forEach($scope.repositoryForm, function (field) {
41
+ if ($scope.repositoryForm.hasOwnProperty(field) && field.hasOwnProperty('$modelValue')) {
42
+ field.$setValidity('server', true);
43
+ $scope.repositoryForm[field].$error.messages = [];
44
+ }
45
+ });
46
+
47
+ angular.forEach(response.data.errors, function (errors, field) {
48
+ if ($scope.repositoryForm.hasOwnProperty(field)) {
49
+ foundError = true;
50
+ $scope.repositoryForm[field].$setValidity('server', false);
51
+ $scope.repositoryForm[field].$error.messages = errors;
52
+ }
53
+ });
54
+
55
+ if (!foundError) {
56
+ Notification.setErrorMessage(response.data.displayMessage);
43
57
  }
58
+ }
59
+
60
+ $scope.page = {
61
+ error: false,
62
+ loading: true
63
+ };
64
+
65
+ $scope.repository = new Repository({'product_id': $scope.$stateParams.productId, unprotected: true,
66
+ 'checksum_type': null, 'mirror_on_sync': true, 'verify_ssl_on_sync': true,
67
+ 'download_policy': BastionConfig.defaultDownloadPolicy, 'arch': null,
68
+ 'ostree_upstream_sync_policy': 'latest'});
69
+
70
+ $scope.product = Product.get({id: $scope.$stateParams.productId}, function () {
71
+ $scope.page.loading = false;
72
+ }, function (response) {
73
+ $scope.page.loading = false;
74
+ ApiErrorHandler.handleGETRequestErrors(response, $scope);
44
75
  });
45
76
 
46
- angular.forEach(response.data.errors, function (errors, field) {
47
- if ($scope.repositoryForm.hasOwnProperty(field)) {
48
- foundError = true;
49
- $scope.repositoryForm[field].$setValidity('server', false);
50
- $scope.repositoryForm[field].$error.messages = errors;
77
+ $scope.repositoryTypes = RepositoryTypesService.creatable();
78
+ $scope.repositoryTypes = _.sortBy($scope.repositoryTypes, 'name');
79
+
80
+ $scope.checksums = Checksum.checksums;
81
+ $scope.downloadPolicies = DownloadPolicy.downloadPolicies;
82
+ $scope.ostreeUpstreamSyncPolicies = OstreeUpstreamSyncPolicy.syncPolicies;
83
+ $scope.ignorableYumContentUnits = YumContentUnits.units;
84
+
85
+ $scope.$watch('repository.name', function () {
86
+ if ($scope.repositoryForm && $scope.repositoryForm.name) {
87
+ $scope.repositoryForm.name.$setValidity('server', true);
88
+ FormUtils.labelize($scope.repository);
51
89
  }
52
90
  });
53
91
 
54
- if (!foundError) {
55
- Notification.setErrorMessage(response.data.displayMessage);
56
- }
57
- }
58
-
59
- $scope.page = {
60
- error: false,
61
- loading: true
62
- };
63
-
64
- $scope.repository = new Repository({'product_id': $scope.$stateParams.productId, unprotected: true,
65
- 'checksum_type': null, 'mirror_on_sync': true, 'verify_ssl_on_sync': true,
66
- 'download_policy': BastionConfig.defaultDownloadPolicy, 'arch': null,
67
- 'ostree_upstream_sync_policy': 'latest'});
68
-
69
- $scope.product = Product.get({id: $scope.$stateParams.productId}, function () {
70
- $scope.page.loading = false;
71
- }, function (response) {
72
- $scope.page.loading = false;
73
- ApiErrorHandler.handleGETRequestErrors(response, $scope);
74
- });
75
-
76
- $scope.repositoryTypes = RepositoryTypesService.creatable();
77
- $scope.repositoryTypes = _.sortBy($scope.repositoryTypes, 'name');
78
-
79
- $scope.checksums = Checksum.checksums;
80
- $scope.downloadPolicies = DownloadPolicy.downloadPolicies;
81
- $scope.ostreeUpstreamSyncPolicies = OstreeUpstreamSyncPolicy.syncPolicies;
82
- $scope.ignorableYumContentUnits = YumContentUnits.units;
83
-
84
- $scope.$watch('repository.name', function () {
85
- if ($scope.repositoryForm && $scope.repositoryForm.name) {
86
- $scope.repositoryForm.name.$setValidity('server', true);
87
- FormUtils.labelize($scope.repository);
88
- }
89
- });
90
-
91
- $scope.handleFiles = function (element) {
92
- var reader = new FileReader();
93
- reader.addEventListener("loadend", function() {
94
- var data = reader.result;
95
- /* eslint-disable camelcase */
96
- $scope.repository.ansible_collection_requirements = data;
97
- $scope.$apply();
98
- });
99
- reader.readAsText(element.files[0]);
100
- };
101
-
102
- ContentCredential.queryUnpaged(function (contentCredentials) {
103
- $scope.contentCredentials = contentCredentials.results;
104
- });
105
-
106
- Architecture.queryUnpaged(function (architecture) {
107
- var results = architecture.results;
108
- var noarch = {
109
- id: 'noarch',
110
- name: translate('Default'),
111
- value: null
92
+ $scope.handleFiles = function (element) {
93
+ var reader = new FileReader();
94
+ reader.addEventListener("loadend", function() {
95
+ var data = reader.result;
96
+ /* eslint-disable camelcase */
97
+ $scope.repository.ansible_collection_requirements = data;
98
+ $scope.$apply();
99
+ });
100
+ reader.readAsText(element.files[0]);
112
101
  };
113
- results.map(function(i) {
114
- i.id = i.name;
102
+
103
+ ContentCredential.queryUnpaged(function (contentCredentials) {
104
+ $scope.contentCredentials = contentCredentials.results;
115
105
  });
116
- results.unshift(noarch);
117
- $scope.architecture = results;
118
- $scope.repository.arch = results[0].id;
119
- });
120
-
121
- $scope.save = function (repository) {
122
- if (repository.content_type === 'ostree') {
123
- repository.unprotected = false;
124
- }
125
- if (repository.content_type !== 'yum') {
126
- repository['download_policy'] = '';
127
- }
128
- if (repository.arch === 'Default') {
129
- repository.arch = null;
130
- }
131
- repository.$save(success, error);
132
- };
133
106
 
134
- $scope.repository['http_proxy_policy'] = HttpProxyPolicy.policies[0].label;
135
- $scope.policies = HttpProxyPolicy.policies;
136
- $scope.proxies = [];
107
+ Architecture.queryUnpaged(function (architecture) {
108
+ var results = architecture.results;
109
+ var noarch = {
110
+ id: 'noarch',
111
+ name: translate('No restriction'),
112
+ value: null
113
+ };
114
+ results.map(function(i) {
115
+ i.id = i.name;
116
+ });
117
+ results.unshift(noarch);
118
+ $scope.architecture = results;
119
+ $scope.repository.arch = results[0].id;
120
+ });
121
+
122
+ $scope.save = function (repository) {
123
+ if (repository.content_type === 'ostree') {
124
+ repository.unprotected = false;
125
+ }
126
+ if (repository.content_type === 'yum') {
127
+ repository.os_versions = $scope.osVersionsParam();
128
+ }
129
+ if (repository.content_type !== 'yum') {
130
+ repository['download_policy'] = '';
131
+ }
132
+ if (repository.arch === 'No restriction') {
133
+ repository.arch = null;
134
+ }
135
+ repository.$save(success, error);
136
+ };
137
+
138
+ $scope.repository['http_proxy_policy'] = HttpProxyPolicy.policies[0].label;
139
+ $scope.policies = HttpProxyPolicy.policies;
140
+ $scope.proxies = [];
137
141
 
138
- $scope.collectionURLPopover = $sce.trustAsHtml("You can sync collections utilizing just the url:<br/>" +
142
+ $scope.collectionURLPopover = $sce.trustAsHtml("You can sync collections utilizing just the url:<br/>" +
139
143
  "<b>1. For all collections in Ansible Galaxy:</b><br/>" +
140
144
  "https://galaxy.ansible.com/api/v2/collections <br/>" +
141
145
  "<b>2. For specific collection with URL filtering:</b><br/>" +
@@ -143,18 +147,26 @@ angular.module('Bastion.repositories').controller('NewRepositoryController',
143
147
  "<b>3. For specific collections with Requirements.yml:</b><br/>" +
144
148
  "Use base URL https://galaxy.ansible.com/ and specify requirements.yml below to specify collections");
145
149
 
146
- $scope.requirementPopover = $sce.trustAsHtml("To learn more about requirement.yml specification, visit <a href='https://docs.ansible.com/ansible/devel/dev_guide/collections_tech_preview.html#install-multiple-collections-with-a-requirements-file' target=\"_blank\">documentation </a>");
150
+ $scope.requirementPopover = $sce.trustAsHtml("To learn more about requirement.yml specification, visit <a href='https://docs.ansible.com/ansible/devel/dev_guide/collections_tech_preview.html#install-multiple-collections-with-a-requirements-file' target=\"_blank\">documentation </a>");
151
+
152
+ $scope.displayHttpProxyPolicyName = function (policy) {
153
+ return HttpProxyPolicy.displayHttpProxyPolicyName(policy);
154
+ };
155
+
156
+ $scope.displayHttpProxyName = function (proxyId) {
157
+ return HttpProxyPolicy.displayHttpProxyName($scope.proxies, proxyId);
158
+ };
159
+
160
+ HttpProxy.queryUnpaged(function (proxies) {
161
+ $scope.proxies = proxies.results;
162
+ });
147
163
 
148
- $scope.displayHttpProxyPolicyName = function (policy) {
149
- return HttpProxyPolicy.displayHttpProxyPolicyName(policy);
150
- };
164
+ $scope.osVersionsOptions = OSVersions.getOSVersionsOptions($scope.repository);
165
+ $scope.repository.os_versions = $scope.osVersionsOptions[0]; // ensure that No restriction is selected initially
151
166
 
152
- $scope.displayHttpProxyName = function (proxyId) {
153
- return HttpProxyPolicy.displayHttpProxyName($scope.proxies, proxyId);
154
- };
167
+ $scope.osVersionsParam = function () {
168
+ return OSVersions.osVersionsParam($scope.repository.os_versions);
169
+ };
155
170
 
156
- HttpProxy.queryUnpaged(function (proxies) {
157
- $scope.proxies = proxies.results;
158
- });
159
- }]
171
+ }]
160
172
  );
@@ -50,10 +50,22 @@
50
50
  ng-model="repository.arch"
51
51
  ng-options="arch.id as arch.name for arch in architecture">
52
52
  </select>
53
- <p class="help-block" translate>
54
- Choose <b>Default</b> to enable the repository for all architectures
55
- </p>
56
53
  </div>
54
+
55
+ <div
56
+ bst-form-group label="{{ 'Restrict to OS version' | translate }}"
57
+ ng-if="repository.content_type === 'yum'"
58
+ >
59
+ <select id="os_versions"
60
+ name="os_versions"
61
+ ng-model="repository.os_versions"
62
+ ng-options="tag as tag.name for tag in osVersionsOptions track by tag.id">
63
+ </select>
64
+ <p class="help-block" translate>
65
+ The repository will be enabled by default on content hosts with the selected OS version.
66
+ </p>
67
+ </div>
68
+
57
69
  </div>
58
70
  <div ng-show="repository.content_type !== undefined">
59
71
  <h4 translate> Sync Settings </h4>
@@ -0,0 +1,46 @@
1
+
2
+ /**
3
+ * @ngdoc service
4
+ * @name Bastion.products.details.repositories.service:OSVersions
5
+ *
6
+ * @description
7
+ * Helper functions for repo osVersions.
8
+ */
9
+
10
+ angular
11
+ .module('Bastion.repositories')
12
+ .service('OSVersions', function () {
13
+
14
+ this.getOSVersionsOptions = function () {
15
+ return [
16
+ { name: 'No restriction', id: '' },
17
+ { name: 'Red Hat Enterprise Linux 8 ', id: 'rhel-8' },
18
+ { name: 'Red Hat Enterprise Linux 7 ', id: 'rhel-7' },
19
+ { name: 'Red Hat Enterprise Linux 6 ', id: 'rhel-6' }
20
+ ];
21
+ };
22
+
23
+ // return an array of OS versions
24
+ this.osVersionsParam = function (osVersion) {
25
+ var param = osVersion;
26
+ if (osVersion && osVersion.hasOwnProperty('id')) {
27
+ param = osVersion.id;
28
+ }
29
+ // exclude null, undefined, and ''
30
+ return [param].filter(function (el) {
31
+ return el && el !== '';
32
+ });
33
+ };
34
+
35
+ // return the OS versions as comma-separated string
36
+ this.formatOSVersions = function (osVersionList) {
37
+ var individualVersions, versionStr;
38
+ individualVersions = this.osVersionsParam(osVersionList);
39
+ if (individualVersions) {
40
+ versionStr = individualVersions.join(",");
41
+ }
42
+ return versionStr;
43
+ };
44
+
45
+ }
46
+ );
@@ -1,5 +1,5 @@
1
1
  <div id="content-access-mode-banner" bst-alert="info" ng-show="simpleContentAccessEnabled">
2
2
  <span translate>
3
- This organization has Simple Content Access enabled. Hosts can consume from all repositories in their Content View regardless of subscription status.
3
+ This organization has Simple Content Access enabled. Hosts are not required to have subscriptions attached to access repositories.
4
4
  </span>
5
5
  </div>
@@ -16,7 +16,7 @@
16
16
  <nav data-block="item-actions" bst-feature-flag="custom_products">
17
17
  <span select-action-dropdown>
18
18
  <ul class="dropdown-menu dropdown-menu-right" uib-dropdown-menu role="menu">
19
- <li role="menuitem" ng-hide="denied('sync_products')">
19
+ <li role="menuitem" ng-hide="denied('sync_sync_plans')">
20
20
  <a ng-click="runSyncPlan()">
21
21
  <span translate>Run Sync Plan</span>
22
22
  </a>
@@ -216,6 +216,7 @@ module Katello
216
216
  ::Api::V2::HostsController.include Katello::Concerns::Api::V2::HostsControllerExtensions
217
217
  ::Api::V2::HostgroupsController.include Katello::Concerns::Api::V2::HostgroupsControllerExtensions
218
218
  ::Api::V2::SmartProxiesController.include Katello::Concerns::Api::V2::SmartProxiesControllerExtensions
219
+ ::Api::V2::RegistrationController.prepend Katello::Concerns::Api::V2::RegistrationControllerExtensions
219
220
 
220
221
  ::HostsController.class_eval do
221
222
  helper Katello::Concerns::HostsAndHostgroupsHelperExtensions
@@ -8,7 +8,6 @@ module Katello
8
8
  activation_keys_permissions
9
9
  capsule_content_permissions
10
10
  content_view_permissions
11
- gpg_key_permissions
12
11
  content_credential_permissions
13
12
  host_collections_permissions
14
13
  lifecycle_environment_permissions
@@ -25,7 +24,8 @@ module Katello
25
24
  'katello/api/v2/activation_keys' => [:index, :show, :available_host_collections, :available_releases,
26
25
  :product_content, :auto_complete_search]
27
26
  },
28
- :resource_type => 'Katello::ActivationKey'
27
+ :resource_type => 'Katello::ActivationKey',
28
+ :finder_scope => :readable
29
29
  @plugin.permission :create_activation_keys,
30
30
  {
31
31
  'katello/api/v2/activation_keys' => [:create, :copy]
@@ -37,12 +37,14 @@ module Katello
37
37
  :add_subscriptions, :remove_subscriptions,
38
38
  :add_host_collections, :remove_host_collections]
39
39
  },
40
- :resource_type => 'Katello::ActivationKey'
40
+ :resource_type => 'Katello::ActivationKey',
41
+ :finder_scope => :editable
41
42
  @plugin.permission :destroy_activation_keys,
42
43
  {
43
44
  'katello/api/v2/activation_keys' => [:destroy]
44
45
  },
45
- :resource_type => 'Katello::ActivationKey'
46
+ :resource_type => 'Katello::ActivationKey',
47
+ :finder_scope => :deletable
46
48
  end
47
49
 
48
50
  def capsule_content_permissions
@@ -72,7 +74,7 @@ module Katello
72
74
  'katello/api/v2/content_view_histories' => [:index, :auto_complete_search],
73
75
  'katello/api/v2/content_view_puppet_modules' => [:index, :show, :auto_complete_search],
74
76
  'katello/api/v2/content_view_repositories' => [:show_all],
75
- 'katello/api/v2/content_view_versions' => [:index, :show, :auto_complete_search, :export_histories],
77
+ 'katello/api/v2/content_view_versions' => [:index, :show, :auto_complete_search, :export_histories, :export_api_status],
76
78
  'katello/api/v2/content_view_components' => [:index, :show],
77
79
  'katello/api/v2/packages' => [:index],
78
80
  'katello/api/v2/package_groups' => [:index, :show, :auto_complete_search, :compare],
@@ -109,7 +111,8 @@ module Katello
109
111
  :view_compare_puppet_modules,
110
112
  :views]
111
113
  },
112
- :resource_type => 'Katello::ContentView'
114
+ :resource_type => 'Katello::ContentView',
115
+ :finder_scope => :readable
113
116
  @plugin.permission :create_content_views,
114
117
  {
115
118
  'katello/api/v2/content_views' => [:create, :copy]
@@ -124,76 +127,65 @@ module Katello
124
127
  'katello/api/v2/content_view_puppet_modules' => [:create, :update, :destroy],
125
128
  'katello/api/v2/content_view_components' => [:add_components, :remove_components, :update]
126
129
  },
127
- :resource_type => 'Katello::ContentView'
130
+ :resource_type => 'Katello::ContentView',
131
+ :finder_scope => :editable
128
132
  @plugin.permission :destroy_content_views,
129
133
  {
130
134
  'katello/api/v2/content_views' => [:destroy, :remove],
131
135
  'katello/api/v2/content_view_versions' => [:destroy]
132
136
  },
133
- :resource_type => 'Katello::ContentView'
137
+ :resource_type => 'Katello::ContentView',
138
+ :finder_scope => :deletable
134
139
  @plugin.permission :publish_content_views,
135
140
  {
136
141
  'katello/api/v2/content_views' => [:publish],
137
142
  'katello/api/v2/content_view_versions' => [:incremental_update, :republish_repositories, :import]
138
143
  },
139
- :resource_type => 'Katello::ContentView'
144
+ :resource_type => 'Katello::ContentView',
145
+ :finder_scope => :publishable
140
146
  @plugin.permission :promote_or_remove_content_views,
141
147
  {
142
148
  'katello/api/v2/content_view_versions' => [:promote],
143
149
  'katello/api/v2/content_views' => [:remove_from_environment, :remove, :republish_repositories]
144
150
  },
145
- :resource_type => 'Katello::ContentView'
151
+ :resource_type => 'Katello::ContentView',
152
+ :finder_scope => :promotable_or_removable
146
153
  @plugin.permission :export_content_views,
147
154
  {
148
- 'katello/api/v2/content_view_versions' => [:export]
149
- },
150
- :resource_type => 'Katello::ContentView'
151
- end
152
-
153
- def gpg_key_permissions
154
- @plugin.permission :view_gpg_keys,
155
- {
156
- 'katello/api/v2/gpg_keys' => [:index, :show, :content, :auto_complete_search]
157
- },
158
- :resource_type => 'Katello::GpgKey'
159
- @plugin.permission :create_gpg_keys,
160
- {
161
- 'katello/api/v2/gpg_keys' => [:create]
162
- },
163
- :resource_type => 'Katello::GpgKey'
164
- @plugin.permission :edit_gpg_keys,
165
- {
166
- 'katello/api/v2/gpg_keys' => [:update, :set_content]
167
- },
168
- :resource_type => 'Katello::GpgKey'
169
- @plugin.permission :destroy_gpg_keys,
170
- {
171
- 'katello/api/v2/gpg_keys' => [:destroy]
155
+ 'katello/api/v2/content_view_versions' => [:export, :export_histories, :export_api_status]
172
156
  },
173
- :resource_type => 'Katello::GpgKey'
157
+ :resource_type => 'Katello::ContentView',
158
+ :finder_scope => :exportable
174
159
  end
175
160
 
176
161
  def content_credential_permissions
177
162
  @plugin.permission :view_content_credentials,
178
163
  {
179
- 'katello/api/v2/content_credentials' => [:index, :show, :content, :auto_complete_search]
164
+ 'katello/api/v2/content_credentials' => [:index, :show, :content, :auto_complete_search],
165
+ 'katello/api/v2/gpg_keys' => [:index, :show, :content, :auto_complete_search]
180
166
  },
181
- :resource_type => 'Katello::GpgKey'
167
+ :resource_type => 'Katello::GpgKey',
168
+ :finder_scope => :readable
182
169
  @plugin.permission :create_content_credentials,
183
170
  {
184
- 'katello/api/v2/content_credentials' => [:create]
171
+ 'katello/api/v2/content_credentials' => [:create],
172
+ 'katello/api/v2/gpg_keys' => [:create]
185
173
  },
186
174
  :resource_type => 'Katello::GpgKey'
187
175
  @plugin.permission :edit_content_credentials,
188
176
  {
189
- 'katello/api/v2/content_credentials' => [:update, :set_content]
177
+ 'katello/api/v2/content_credentials' => [:update, :set_content],
178
+ 'katello/api/v2/gpg_keys' => [:update, :set_content]
190
179
  },
191
- :resource_type => 'Katello::GpgKey'
180
+ :resource_type => 'Katello::GpgKey',
181
+ :finder_scope => :editable
192
182
  @plugin.permission :destroy_content_credentials,
193
183
  {
194
- 'katello/api/v2/content_credentials' => [:destroy]
184
+ 'katello/api/v2/content_credentials' => [:destroy],
185
+ 'katello/api/v2/gpg_keys' => [:destroy]
195
186
  },
196
- :resource_type => 'Katello::GpgKey'
187
+ :resource_type => 'Katello::GpgKey',
188
+ :finder_scope => :deletable
197
189
  end
198
190
 
199
191
  def host_collections_permissions
@@ -201,22 +193,26 @@ module Katello
201
193
  {
202
194
  'katello/api/v2/host_collections' => [:index, :show, :auto_complete_search]
203
195
  },
204
- :resource_type => 'Katello::HostCollection'
196
+ :resource_type => 'Katello::HostCollection',
197
+ :finder_scope => :readable
205
198
  @plugin.permission :create_host_collections,
206
199
  {
207
200
  'katello/api/v2/host_collections' => [:create, :copy]
208
201
  },
209
- :resource_type => 'Katello::HostCollection'
202
+ :resource_type => 'Katello::HostCollection',
203
+ :finder_scope => :creatable
210
204
  @plugin.permission :edit_host_collections,
211
205
  {
212
206
  'katello/api/v2/host_collections' => [:update, :add_hosts, :remove_hosts]
213
207
  },
214
- :resource_type => 'Katello::HostCollection'
208
+ :resource_type => 'Katello::HostCollection',
209
+ :finder_scope => :editable
215
210
  @plugin.permission :destroy_host_collections,
216
211
  {
217
212
  'katello/api/v2/host_collections' => [:destroy]
218
213
  },
219
- :resource_type => 'Katello::HostCollection'
214
+ :resource_type => 'Katello::HostCollection',
215
+ :finder_scope => :deletable
220
216
  end
221
217
 
222
218
  def lifecycle_environment_permissions
@@ -225,26 +221,30 @@ module Katello
225
221
  'katello/api/v2/environments' => [:index, :show, :paths, :repositories, :auto_complete_search],
226
222
  'katello/api/rhsm/candlepin_proxies' => [:rhsm_index]
227
223
  },
228
- :resource_type => 'Katello::KTEnvironment'
224
+ :resource_type => 'Katello::KTEnvironment',
225
+ :finder_scope => :readable
229
226
  @plugin.permission :create_lifecycle_environments,
230
227
  {
231
228
  'katello/api/v2/environments' => [:create]
232
229
  },
233
- :resource_type => 'Katello::KTEnvironment'
230
+ :resource_type => 'Katello::KTEnvironment',
231
+ :finder_scope => :creatable
234
232
  @plugin.permission :edit_lifecycle_environments,
235
233
  {
236
234
  'katello/api/v2/environments' => [:update]
237
235
  },
238
- :resource_type => 'Katello::KTEnvironment'
236
+ :resource_type => 'Katello::KTEnvironment',
237
+ :finder_scope => :editable
239
238
  @plugin.permission :destroy_lifecycle_environments,
240
239
  {
241
240
  'katello/api/v2/environments' => [:destroy]
242
241
  },
243
- :resource_type => 'Katello::KTEnvironment'
244
-
242
+ :resource_type => 'Katello::KTEnvironment',
243
+ :finder_scope => :deletable
245
244
  @plugin.permission :promote_or_remove_content_views_to_environments,
246
245
  {},
247
- :resource_type => 'Katello::KTEnvironment'
246
+ :resource_type => 'Katello::KTEnvironment',
247
+ :finder_scope => :promotable
248
248
  end
249
249
 
250
250
  def product_permissions # rubocop:disable Metrics/MethodLength
@@ -329,7 +329,6 @@ module Katello
329
329
  'katello/api/v2/products_bulk_actions' => [:sync_products],
330
330
  'katello/api/v2/repositories_bulk_actions' => [:sync_repositories],
331
331
  'katello/api/v2/sync' => [:index],
332
- 'katello/api/v2/sync_plans' => [:sync],
333
332
  'katello/sync_management' => [:index, :sync_status, :product_status, :sync, :destroy]
334
333
  },
335
334
  :resource_type => 'Katello::Product',
@@ -372,33 +371,43 @@ module Katello
372
371
  :resource_type => 'Katello::Subscription'
373
372
  @plugin.permission :manage_subscription_allocations,
374
373
  {
375
- 'katello/api/v2/upstream_subscriptions' => [:index, :create, :destroy, :update, :ping, :enable_simple_content_access, :disable_simple_content_access]
374
+ 'katello/api/v2/upstream_subscriptions' => [:index, :create, :destroy, :update, :ping, :enable_simple_content_access, :disable_simple_content_access, :simple_content_access_eligible]
376
375
  },
377
376
  :resource_type => 'Katello::Subscription'
378
377
  end
379
378
 
380
- def sync_plan_permissions
379
+ def sync_plan_permissions # rubocop:disable Metrics/MethodLength
381
380
  @plugin.permission :view_sync_plans,
382
381
  {
383
382
  'katello/api/v2/sync_plans' => [:index, :show, :add_products, :remove_products, :available_products, :auto_complete_search],
384
383
  'katello/api/v2/products' => [:index]
385
384
  },
386
- :resource_type => 'Katello::SyncPlan'
385
+ :resource_type => 'Katello::SyncPlan',
386
+ :finder_scope => :readable
387
387
  @plugin.permission :create_sync_plans,
388
388
  {
389
389
  'katello/api/v2/sync_plans' => [:create]
390
390
  },
391
- :resource_type => 'Katello::SyncPlan'
391
+ :resource_type => 'Katello::SyncPlan',
392
+ :finder_scope => :editable
392
393
  @plugin.permission :edit_sync_plans,
393
394
  {
394
395
  'katello/api/v2/sync_plans' => [:update]
395
396
  },
396
- :resource_type => 'Katello::SyncPlan'
397
+ :resource_type => 'Katello::SyncPlan',
398
+ :finder_scope => :editable
397
399
  @plugin.permission :destroy_sync_plans,
398
400
  {
399
401
  'katello/api/v2/sync_plans' => [:destroy]
400
402
  },
401
- :resource_type => 'Katello::SyncPlan'
403
+ :resource_type => 'Katello::SyncPlan',
404
+ :finder_scope => :deletable
405
+ @plugin.permission :sync_sync_plans,
406
+ {
407
+ 'katello/api/v2/sync_plans' => [:sync]
408
+ },
409
+ :resource_type => 'Katello::SyncPlan',
410
+ :finder_scope => :syncable
402
411
  end
403
412
 
404
413
  def user_permissions