katello 3.4.4 → 3.4.5

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/api_controller.rb +1 -1
  3. data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -1
  4. data/app/controllers/katello/concerns/api/v2/content_overrides_controller.rb +1 -1
  5. data/app/helpers/katello/concerns/dashboard_helper_extensions.rb +30 -0
  6. data/app/lib/actions/candlepin/owner/import_products.rb +3 -1
  7. data/app/lib/actions/katello/capsule_content/sync.rb +2 -1
  8. data/app/lib/actions/katello/host/hypervisors_update.rb +3 -1
  9. data/app/lib/actions/katello/host/register.rb +15 -8
  10. data/app/lib/actions/katello/organization/create.rb +2 -2
  11. data/app/lib/actions/katello/organization/manifest_refresh.rb +2 -1
  12. data/app/models/katello/glue/candlepin/pool.rb +6 -1
  13. data/app/models/katello/rhsm_fact_parser.rb +2 -1
  14. data/app/views/dashboard/_subscription_widget.html.erb +34 -12
  15. data/db/migrate/20161014133811_move_content_view_version_description_to_histories.rb +11 -10
  16. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +6 -2
  17. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-host-collections-table.html +1 -2
  18. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/select-action-dropdown.html +2 -2
  19. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +0 -1
  20. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -3
  21. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +1 -3
  22. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filters.html +1 -2
  23. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/views/docker-tag-environments.html +1 -4
  24. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-content-hosts.html +1 -3
  25. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-repositories.html +1 -3
  26. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/files/details/views/file-content-views.html +1 -3
  27. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/files/details/views/file-repositories.html +1 -3
  28. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/views/gpg-keys.html +1 -5
  29. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-add-hosts.controller.js +5 -2
  30. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-hosts.controller.js +6 -2
  31. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-add-hosts.html +1 -3
  32. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-hosts-list.html +1 -3
  33. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/views/host-collections.html +1 -3
  34. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch-repositories.html +1 -3
  35. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/package-repositories.html +1 -3
  36. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +8 -11
  37. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +1 -2
  38. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery-create.html +1 -3
  39. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery.html +1 -4
  40. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/details/views/puppet-module-content-views.html +1 -3
  41. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/details/views/puppet-module-repositories.html +1 -3
  42. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/subscriptions.html +1 -1
  43. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-products.html +1 -2
  44. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/views/sync-plans.html +1 -3
  45. data/lib/katello/engine.rb +4 -0
  46. data/lib/katello/permission_creator.rb +361 -0
  47. data/lib/katello/permissions/user_permissions.rb +0 -8
  48. data/lib/katello/plugin.rb +6 -1
  49. data/lib/katello/tasks/upgrades/3.4/remove_unused_products.rake +28 -0
  50. data/lib/katello/version.rb +1 -1
  51. metadata +5 -11
  52. data/lib/katello/permissions/activation_key_permissions.rb +0 -28
  53. data/lib/katello/permissions/capsule_content_permissions.rb +0 -17
  54. data/lib/katello/permissions/content_view_permissions.rb +0 -82
  55. data/lib/katello/permissions/gpg_key_permissions.rb +0 -24
  56. data/lib/katello/permissions/host_collections_permissions.rb +0 -24
  57. data/lib/katello/permissions/lifecycle_environment_permissions.rb +0 -29
  58. data/lib/katello/permissions/product_permissions.rb +0 -80
  59. data/lib/katello/permissions/subscription_permissions.rb +0 -33
  60. data/lib/katello/permissions/sync_plan_permissions.rb +0 -25
@@ -31,9 +31,7 @@
31
31
  </span>
32
32
 
33
33
  <div data-block="table">
34
- <table class="table table-striped table-bordered"
35
- ng-class="{'table-mask': table.working}"
36
- ng-show="table.rows.length > 0">
34
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
37
35
  <thead>
38
36
  <tr bst-table-head>
39
37
  <th bst-table-column="name"><span translate>Name</span></th>
@@ -12,9 +12,7 @@
12
12
  </span>
13
13
 
14
14
  <div data-block="table">
15
- <table class="table table-striped table-bordered"
16
- ng-class="{'table-mask': table.working}"
17
- ng-show="table.rows.length > 0">
15
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
18
16
  <thead>
19
17
  <tr bst-table-head>
20
18
  <th bst-table-column="name"><span translate>Name</span></th>
@@ -12,9 +12,7 @@
12
12
  </span>
13
13
 
14
14
  <div data-block="table">
15
- <table class="table table-striped table-bordered"
16
- ng-class="{'table-mask': table.working}"
17
- ng-show="table.rows.length > 0">
15
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
18
16
  <thead>
19
17
  <tr bst-table-head>
20
18
  <th bst-table-column="name"><span translate>Name</span></th>
@@ -20,11 +20,7 @@
20
20
  </span>
21
21
 
22
22
  <div data-block="table">
23
- <table bst-table="table"
24
- type="button"
25
- class="table table-striped table-bordered"
26
- ng-class="{'table-mask': table.working}"
27
- ng-show="table.rows.length > 0">
23
+ <table bst-table="table" class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
28
24
  <thead>
29
25
  <tr bst-table-head>
30
26
  <th bst-table-column="name" sortable><span translate>Name</span></th>
@@ -16,7 +16,7 @@
16
16
  angular.module('Bastion.host-collections').controller('HostCollectionAddHostsController',
17
17
  ['$scope', '$state', '$location', 'translate', 'Nutupane', 'CurrentOrganization', 'Host', 'HostCollection',
18
18
  function ($scope, $state, $location, translate, Nutupane, CurrentOrganization, Host, HostCollection) {
19
- var contentNutupane, params;
19
+ var contentNutupane, params, nutupaneParams;
20
20
 
21
21
  params = {
22
22
  'organization_id': CurrentOrganization,
@@ -27,7 +27,10 @@ angular.module('Bastion.host-collections').controller('HostCollectionAddHostsCon
27
27
  'paged': true
28
28
  };
29
29
 
30
- contentNutupane = new Nutupane(Host, params);
30
+ nutupaneParams = {
31
+ 'disableAutoLoad': true
32
+ };
33
+ contentNutupane = new Nutupane(Host, params, undefined, nutupaneParams);
31
34
  $scope.controllerName = 'hosts';
32
35
  contentNutupane.searchTransform = function (term) {
33
36
  var addition = "-host_collection_id=" + $scope.$stateParams.hostCollectionId;
@@ -16,7 +16,7 @@
16
16
  angular.module('Bastion.host-collections').controller('HostCollectionHostsController',
17
17
  ['$scope', '$location', 'translate', 'Nutupane', 'CurrentOrganization', 'Host', 'HostCollection',
18
18
  function ($scope, $location, translate, Nutupane, CurrentOrganization, Host, HostCollection) {
19
- var params;
19
+ var params, nutupaneParams;
20
20
 
21
21
  params = {
22
22
  'organization_id': CurrentOrganization,
@@ -27,7 +27,11 @@ angular.module('Bastion.host-collections').controller('HostCollectionHostsContro
27
27
  'paged': true
28
28
  };
29
29
 
30
- $scope.contentNutupane = new Nutupane(Host, params);
30
+ nutupaneParams = {
31
+ 'disableAutoLoad': true
32
+ };
33
+
34
+ $scope.contentNutupane = new Nutupane(Host, params, undefined, nutupaneParams);
31
35
  $scope.controllerName = 'hosts';
32
36
  $scope.contentNutupane.searchTransform = function (term) {
33
37
  var addition = "host_collection_id=" + $scope.$stateParams.hostCollectionId;
@@ -22,9 +22,7 @@
22
22
  </span>
23
23
 
24
24
  <div data-block="table">
25
- <table ng-class="{'table-mask': table.working}"
26
- class="table table-bordered table-striped"
27
- ng-show="table.rows.length > 0">
25
+ <table ng-class="{'table-mask': table.working}" class="table table-bordered table-striped">
28
26
  <thead>
29
27
  <tr bst-table-head row-select>
30
28
  <th bst-table-column="name" translate>Name</th>
@@ -22,9 +22,7 @@
22
22
  </span>
23
23
 
24
24
  <div data-block="table">
25
- <table ng-class="{'table-mask': table.working}"
26
- class="table table-bordered table-striped"
27
- ng-show="table.rows.length > 0">
25
+ <table ng-class="{'table-mask': table.working}" class="table table-bordered table-striped">
28
26
  <thead>
29
27
  <tr bst-table-head row-select>
30
28
  <th bst-table-column="name" translate>Name</th>
@@ -23,9 +23,7 @@
23
23
  </span>
24
24
 
25
25
  <div data-block="table">
26
- <table class="table table-striped table-bordered"
27
- ng-class="{'table-mask': table.working}"
28
- ng-show="table.rows.length > 0">
26
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
29
27
  <thead>
30
28
  <tr bst-table-head>
31
29
  <th bst-table-column="name" sortable><span translate>Name</span></th>
@@ -31,9 +31,7 @@
31
31
  </span>
32
32
 
33
33
  <div data-block="table">
34
- <table class="table table-striped table-bordered"
35
- ng-class="{'table-mask': table.working}"
36
- ng-show="table.rows.length > 0">
34
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
37
35
  <thead>
38
36
  <tr bst-table-head>
39
37
  <th bst-table-column="name"><span translate>Name</span></th>
@@ -32,9 +32,7 @@
32
32
  </span>
33
33
 
34
34
  <div data-block="table">
35
- <table class="table table-striped table-bordered"
36
- ng-class="{'table-mask': table.working}"
37
- ng-show="table.rows.length > 0">
35
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
38
36
  <thead>
39
37
  <tr bst-table-head>
40
38
  <th bst-table-column="name"><span translate>Name</span></th>
@@ -5,6 +5,7 @@
5
5
  * @requires $scope
6
6
  * @requires $q
7
7
  * @requires translate
8
+ * @requires GlobalNotification
8
9
  * @requires GPGKey
9
10
  * @requires CurrentOrganization
10
11
  * @requires Checksum
@@ -15,12 +16,8 @@
15
16
  * Provides the functionality for the repository details info page.
16
17
  */
17
18
  angular.module('Bastion.repositories').controller('RepositoryDetailsInfoController',
18
- ['$scope', '$q', 'translate', 'GPGKey', 'CurrentOrganization', 'Checksum', 'DownloadPolicy', 'OstreeUpstreamSyncPolicy',
19
- function ($scope, $q, translate, GPGKey, CurrentOrganization, Checksum, DownloadPolicy, OstreeUpstreamSyncPolicy) {
20
- $scope.successMessages = [];
21
- $scope.errorMessages = [];
22
- $scope.uploadSuccessMessages = [];
23
- $scope.uploadErrorMessages = [];
19
+ ['$scope', '$q', 'translate', 'GlobalNotification', 'GPGKey', 'CurrentOrganization', 'Checksum', 'DownloadPolicy', 'OstreeUpstreamSyncPolicy',
20
+ function ($scope, $q, translate, GlobalNotification, GPGKey, CurrentOrganization, Checksum, DownloadPolicy, OstreeUpstreamSyncPolicy) {
24
21
  $scope.organization = CurrentOrganization;
25
22
 
26
23
  $scope.progress = {uploading: false};
@@ -47,11 +44,11 @@ angular.module('Bastion.repositories').controller('RepositoryDetailsInfoControll
47
44
 
48
45
  repository.$update(function (response) {
49
46
  deferred.resolve(response);
50
- $scope.successMessages = [translate('Repository Saved.')];
47
+ GlobalNotification.setSuccessMessage(translate('Repository Saved.'));
51
48
  }, function (response) {
52
49
  deferred.reject(response);
53
50
  _.each(response.data.errors, function (errorMessage) {
54
- $scope.errorMessages.push(translate("An error occurred saving the Repository: ") + errorMessage);
51
+ GlobalNotification.setErrorMessage(translate("An error occurred saving the Repository: ") + errorMessage);
55
52
  });
56
53
  });
57
54
 
@@ -74,11 +71,11 @@ angular.module('Bastion.repositories').controller('RepositoryDetailsInfoControll
74
71
 
75
72
  if (returnData !== null && returnData.status === 'success') {
76
73
  uploaded = returnData.filenames.join(', ');
77
- $scope.uploadSuccessMessages = [translate('Successfully uploaded content: ') + uploaded];
74
+ GlobalNotification.setSuccessMessage(translate('Successfully uploaded content: ') + uploaded);
78
75
  $scope.repository.$get();
79
76
  } else {
80
77
  error = returnData.displayMessage;
81
- $scope.uploadErrorMessages = [translate('Error during upload: ') + error];
78
+ GlobalNotification.setErrorMessage(translate('Error during upload: ') + error);
82
79
  }
83
80
 
84
81
  $scope.progress.uploading = false;
@@ -91,7 +88,7 @@ angular.module('Bastion.repositories').controller('RepositoryDetailsInfoControll
91
88
  } else {
92
89
  error = content;
93
90
  }
94
- $scope.uploadErrorMessages = [translate('Error during upload: ') + error];
91
+ GlobalNotification.setErrorMessage(translate('Error during upload: ') + error);
95
92
  $scope.progress.uploading = false;
96
93
  };
97
94
 
@@ -88,8 +88,7 @@
88
88
  </span>
89
89
 
90
90
  <div data-block="table">
91
- <table class="table table-striped table-bordered"
92
- ng-show="table.rows.length > 0">
91
+ <table class="table table-striped table-bordered">
93
92
  <thead>
94
93
  <tr bst-table-head row-select>
95
94
  <th bst-table-column="name" translate>Name</th>
@@ -123,9 +123,7 @@
123
123
  </span>
124
124
 
125
125
  <div data-block="table">
126
- <table bst-table="table"
127
- class="table table-full table-bordered"
128
- ng-show="table.rows.length > 0">
126
+ <table bst-table="table" class="table table-full table-bordered">
129
127
  <thead>
130
128
  <tr bst-table-head>
131
129
  <th bst-table-column="task" translate>Create Status</th>
@@ -93,10 +93,7 @@
93
93
  </span>
94
94
 
95
95
  <div data-block="table">
96
- <table bst-table="table"
97
- class="table table-full table-bordered"
98
- ng-class="{'table-mask': discovery.working}"
99
- ng-show="table.rows.length > 0">
96
+ <table bst-table="table" class="table table-full table-bordered" ng-class="{'table-mask': discovery.working}">
100
97
  <thead>
101
98
  <tr bst-table-head row-select>
102
99
  <th bst-table-column="path" translate>Discovered Repository</th>
@@ -12,9 +12,7 @@
12
12
  </span>
13
13
 
14
14
  <div data-block="table">
15
- <table class="table table-striped table-bordered"
16
- ng-class="{'table-mask': table.working}"
17
- ng-show="table.rows.length > 0">
15
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
18
16
  <thead>
19
17
  <tr bst-table-head>
20
18
  <th bst-table-column="name"><span translate>Name</span></th>
@@ -12,9 +12,7 @@
12
12
  </span>
13
13
 
14
14
  <div data-block="table">
15
- <table class="table table-striped table-bordered"
16
- ng-class="{'table-mask': table.working}"
17
- ng-show="table.rows.length > 0">
15
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
18
16
  <thead>
19
17
  <tr bst-table-head>
20
18
  <th bst-table-column="name"><span translate>Name</span></th>
@@ -23,7 +23,7 @@
23
23
  </span>
24
24
 
25
25
  <div data-block="table">
26
- <table class="table table-bordered" ng-class="{'table-mask': table.working}" ng-show="table.rows.length > 0">
26
+ <table class="table table-bordered" ng-class="{'table-mask': table.working}">
27
27
  <thead>
28
28
  <tr bst-table-head>
29
29
  <th bst-table-column="consumed" class="align-center"><span translate>Consumed</span></th>
@@ -49,8 +49,7 @@
49
49
  </span>
50
50
 
51
51
  <div data-block="table">
52
- <table ng-show="table.rows.length > 0"
53
- ng-class="{'table-mask': table.working}" class="table table-bordered table-striped">
52
+ <table ng-class="{'table-mask': table.working}" class="table table-bordered table-striped">
54
53
  <thead>
55
54
  <tr bst-table-head row-select="product">
56
55
  <th bst-table-column="name" translate>Name</th>
@@ -21,9 +21,7 @@
21
21
  </span>
22
22
 
23
23
  <div data-block="table">
24
- <table class="table table-striped table-bordered"
25
- ng-class="{'table-mask': syncPlanTable.working}"
26
- ng-show="syncPlanTable.rows.length > 0">
24
+ <table class="table table-striped table-bordered" ng-class="{'table-mask': syncPlanTable.working}">
27
25
  <thead>
28
26
  <tr bst-table-head>
29
27
  <th bst-table-column="name" sortable><span translate>Name</span></th>
@@ -99,6 +99,7 @@ module Katello
99
99
  # hook so that the resumed Dynflow tasks can rely on everything ready.
100
100
  initializer 'katello.register_plugin', :before => :finisher_hook do
101
101
  require 'katello/plugin'
102
+ # extend builtin permissions from core with new actions
102
103
  require 'katello/permissions'
103
104
  end
104
105
 
@@ -211,6 +212,9 @@ module Katello
211
212
  helper Katello::Concerns::SmartProxyHelperExtensions
212
213
  end
213
214
 
215
+ ::DashboardController.class_eval do
216
+ helper Katello::Concerns::DashboardHelperExtensions
217
+ end
214
218
  #Handle Smart Proxy items separately
215
219
  begin
216
220
  ::SmartProxy.send :include, Katello::Concerns::SmartProxyExtensions
@@ -0,0 +1,361 @@
1
+ module Katello
2
+ class PermissionCreator
3
+ def initialize(plugin)
4
+ @plugin = plugin
5
+ end
6
+
7
+ def define
8
+ activation_keys_permissions
9
+ capsule_content_permissions
10
+ content_view_permissions
11
+ gpg_key_permissions
12
+ host_collections_permissions
13
+ lifecycle_environment_permissions
14
+ product_permissions
15
+ subscription_permissions
16
+ sync_plan_permissions
17
+ user_permissions
18
+ end
19
+
20
+ def activation_keys_permissions
21
+ @plugin.permission :view_activation_keys,
22
+ {
23
+ 'katello/activation_keys' => [:all, :index],
24
+ 'katello/api/v2/activation_keys' => [:index, :show, :available_host_collections, :available_releases,
25
+ :product_content, :auto_complete_search]
26
+ },
27
+ :resource_type => 'Katello::ActivationKey'
28
+ @plugin.permission :create_activation_keys,
29
+ {
30
+ 'katello/api/v2/activation_keys' => [:create, :copy]
31
+ },
32
+ :resource_type => 'Katello::ActivationKey'
33
+ @plugin.permission :edit_activation_keys,
34
+ {
35
+ 'katello/api/v2/activation_keys' => [:update, :content_override,
36
+ :add_subscriptions, :remove_subscriptions,
37
+ :add_host_collections, :remove_host_collections]
38
+ },
39
+ :resource_type => 'Katello::ActivationKey'
40
+ @plugin.permission :destroy_activation_keys,
41
+ {
42
+ 'katello/api/v2/activation_keys' => [:destroy]
43
+ },
44
+ :resource_type => 'Katello::ActivationKey'
45
+ end
46
+
47
+ def capsule_content_permissions
48
+ @plugin.permission :manage_capsule_content,
49
+ {
50
+ 'katello/api/v2/capsule_content' => [:lifecycle_environments, :available_lifecycle_environments, :add_lifecycle_environment, :remove_lifecycle_environment,
51
+ :sync, :sync_status, :cancel_sync],
52
+ 'katello/api/v2/capsules' => [:index, :show]
53
+ },
54
+ :resource_type => 'SmartProxy'
55
+
56
+ @plugin.permission :view_capsule_content,
57
+ {
58
+ 'smart_proxies' => [:pulp_storage, :pulp_status, :show_with_content]
59
+ },
60
+ :resource_type => "SmartProxy"
61
+ end
62
+
63
+ def content_view_permissions # rubocop:disable Metrics/MethodLength
64
+ @plugin.permission :view_content_views,
65
+ {
66
+ 'katello/api/v2/content_views' => [:index, :show, :available_puppet_modules, :auto_complete_search,
67
+ :available_puppet_module_names],
68
+ 'katello/api/v2/content_view_filters' => [:index, :show, :auto_complete_search],
69
+ 'katello/api/v2/content_view_filter_rules' => [:index, :show],
70
+ 'katello/api/v2/content_view_histories' => [:index, :auto_complete_search],
71
+ 'katello/api/v2/content_view_puppet_modules' => [:index, :show, :auto_complete_search],
72
+ 'katello/api/v2/content_view_versions' => [:index, :show, :auto_complete_search],
73
+ 'katello/api/v2/content_view_components' => [:index, :show],
74
+ 'katello/api/v2/package_groups' => [:index, :show],
75
+ 'katello/api/v2/errata' => [:index, :show],
76
+ 'katello/api/v2/puppet_modules' => [:index, :show],
77
+ 'katello/content_views' => [:auto_complete, :auto_complete_search],
78
+ 'katello/errata' => [:short_details, :auto_complete],
79
+ 'katello/packages' => [:details, :auto_complete],
80
+ 'katello/products' => [:auto_complete],
81
+ 'katello/repositories' => [:auto_complete_library],
82
+ 'katello/content_search' => [:index,
83
+ :products,
84
+ :repos,
85
+ :packages,
86
+ :errata,
87
+ :puppet_modules,
88
+ :packages_items,
89
+ :errata_items,
90
+ :puppet_modules_items,
91
+ :view_packages,
92
+ :view_puppet_modules,
93
+ :repo_packages,
94
+ :repo_errata,
95
+ :repo_puppet_modules,
96
+ :repo_compare_errata,
97
+ :repo_compare_packages,
98
+ :repo_compare_puppet_modules,
99
+ :view_compare_errata,
100
+ :view_compare_packages,
101
+ :view_compare_puppet_modules,
102
+ :views]
103
+ },
104
+ :resource_type => 'Katello::ContentView'
105
+ @plugin.permission :create_content_views,
106
+ {
107
+ 'katello/api/v2/content_views' => [:create, :copy]
108
+ },
109
+ :resource_type => 'Katello::ContentView'
110
+ @plugin.permission :edit_content_views,
111
+ {
112
+ 'katello/api/v2/content_views' => [:update],
113
+ 'katello/api/v2/content_view_filters' => [:create, :update, :destroy],
114
+ 'katello/api/v2/content_view_filter_rules' => [:create, :update, :destroy],
115
+ 'katello/api/v2/content_view_puppet_modules' => [:create, :update, :destroy],
116
+ 'katello/api/v2/content_view_components' => [:add_components, :remove_components, :update]
117
+ },
118
+ :resource_type => 'Katello::ContentView'
119
+ @plugin.permission :destroy_content_views,
120
+ {
121
+ 'katello/api/v2/content_views' => [:destroy, :remove],
122
+ 'katello/api/v2/content_view_versions' => [:destroy]
123
+ },
124
+ :resource_type => 'Katello::ContentView'
125
+ @plugin.permission :publish_content_views,
126
+ {
127
+ 'katello/api/v2/content_views' => [:publish],
128
+ 'katello/api/v2/content_view_versions' => [:incremental_update, :republish_repositories]
129
+ },
130
+ :resource_type => 'Katello::ContentView'
131
+ @plugin.permission :promote_or_remove_content_views,
132
+ {
133
+ 'katello/api/v2/content_view_versions' => [:promote],
134
+ 'katello/api/v2/content_views' => [:remove_from_environment, :remove, :republish_repositories]
135
+ },
136
+ :resource_type => 'Katello::ContentView'
137
+ @plugin.permission :export_content_views,
138
+ {
139
+ 'katello/api/v2/content_view_versions' => [:export]
140
+ },
141
+ :resource_type => 'Katello::ContentView'
142
+ end
143
+
144
+ def gpg_key_permissions
145
+ @plugin.permission :view_gpg_keys,
146
+ {
147
+ 'katello/api/v2/gpg_keys' => [:index, :show, :auto_complete_search]
148
+ },
149
+ :resource_type => 'Katello::GpgKey'
150
+ @plugin.permission :create_gpg_keys,
151
+ {
152
+ 'katello/api/v2/gpg_keys' => [:create]
153
+ },
154
+ :resource_type => 'Katello::GpgKey'
155
+ @plugin.permission :edit_gpg_keys,
156
+ {
157
+ 'katello/api/v2/gpg_keys' => [:update, :content]
158
+ },
159
+ :resource_type => 'Katello::GpgKey'
160
+ @plugin.permission :destroy_gpg_keys,
161
+ {
162
+ 'katello/api/v2/gpg_keys' => [:destroy]
163
+ },
164
+ :resource_type => 'Katello::GpgKey'
165
+ end
166
+
167
+ def host_collections_permissions
168
+ @plugin.permission :view_host_collections,
169
+ {
170
+ 'katello/api/v2/host_collections' => [:index, :show, :auto_complete_search]
171
+ },
172
+ :resource_type => 'Katello::HostCollection'
173
+ @plugin.permission :create_host_collections,
174
+ {
175
+ 'katello/api/v2/host_collections' => [:create, :copy]
176
+ },
177
+ :resource_type => 'Katello::HostCollection'
178
+ @plugin.permission :edit_host_collections,
179
+ {
180
+ 'katello/api/v2/host_collections' => [:update, :add_hosts, :remove_hosts]
181
+ },
182
+ :resource_type => 'Katello::HostCollection'
183
+ @plugin.permission :destroy_host_collections,
184
+ {
185
+ 'katello/api/v2/host_collections' => [:destroy]
186
+ },
187
+ :resource_type => 'Katello::HostCollection'
188
+ end
189
+
190
+ def lifecycle_environment_permissions
191
+ @plugin.permission :view_lifecycle_environments,
192
+ {
193
+ 'katello/api/v2/environments' => [:index, :show, :paths, :repositories, :auto_complete_search],
194
+ 'katello/api/rhsm/candlepin_proxies' => [:rhsm_index]
195
+ },
196
+ :resource_type => 'Katello::KTEnvironment'
197
+ @plugin.permission :create_lifecycle_environments,
198
+ {
199
+ 'katello/api/v2/environments' => [:create]
200
+ },
201
+ :resource_type => 'Katello::KTEnvironment'
202
+ @plugin.permission :edit_lifecycle_environments,
203
+ {
204
+ 'katello/api/v2/environments' => [:update]
205
+ },
206
+ :resource_type => 'Katello::KTEnvironment'
207
+ @plugin.permission :destroy_lifecycle_environments,
208
+ {
209
+ 'katello/api/v2/environments' => [:destroy]
210
+ },
211
+ :resource_type => 'Katello::KTEnvironment'
212
+
213
+ @plugin.permission :promote_or_remove_content_views_to_environments,
214
+ {},
215
+ :resource_type => 'Katello::KTEnvironment'
216
+ end
217
+
218
+ def product_permissions # rubocop:disable Metrics/MethodLength
219
+ @plugin.permission :view_products,
220
+ {
221
+ 'katello/products' => [:auto_complete, :auto_complete_search],
222
+ 'katello/api/v2/products' => [:index, :show, :auto_complete_search],
223
+ 'katello/api/v2/repositories' => [:index, :show, :repository_types, :auto_complete_search, :cancel],
224
+ 'katello/api/v2/packages' => [:index, :show, :auto_complete_search, :auto_complete_name, :auto_complete_arch],
225
+ 'katello/api/v2/package_groups' => [:index, :show, :auto_complete_search],
226
+ 'katello/api/v2/docker_manifests' => [:index, :show, :auto_complete_search],
227
+ 'katello/api/v2/docker_tags' => [:index, :show, :auto_complete_search, :auto_complete_name],
228
+ 'katello/api/v2/file_units' => [:index, :show, :auto_complete_search],
229
+ 'katello/api/v2/ostree_branches' => [:index, :show, :auto_complete_search],
230
+ 'katello/api/v2/errata' => [:index, :show, :auto_complete_search, :compare],
231
+ 'katello/api/v2/puppet_modules' => [:index, :show, :auto_complete_search],
232
+ 'katello/errata' => [:short_details, :auto_complete],
233
+ 'katello/packages' => [:details, :auto_complete],
234
+ 'katello/puppet_modules' => [:show],
235
+ 'katello/files' => [:auto_complete],
236
+ 'katello/repositories' => [:auto_complete_library, :repository_types],
237
+ 'katello/content_search' => [:index,
238
+ :products,
239
+ :repos,
240
+ :packages,
241
+ :errata,
242
+ :puppet_modules,
243
+ :packages_items,
244
+ :errata_items,
245
+ :puppet_modules_items,
246
+ :repo_packages,
247
+ :repo_errata,
248
+ :repo_puppet_modules,
249
+ :repo_compare_errata,
250
+ :repo_compare_packages,
251
+ :repo_compare_puppet_modules]
252
+ },
253
+ :resource_type => 'Katello::Product'
254
+ @plugin.permission :create_products,
255
+ {
256
+ 'katello/api/v2/products' => [:create],
257
+ 'katello/api/v2/repositories' => [:create],
258
+ 'katello/api/v2/package_groups' => [:create]
259
+ },
260
+ :resource_type => 'Katello::Product'
261
+ @plugin.permission :edit_products,
262
+ {
263
+ 'katello/api/v2/products' => [:update],
264
+ 'katello/api/v2/repositories' => [:update, :remove_content, :import_uploads, :upload_content, :republish],
265
+ 'katello/api/v2/products_bulk_actions' => [:update_sync_plans],
266
+ 'katello/api/v2/content_uploads' => [:create, :update, :destroy],
267
+ 'katello/api/v2/organizations' => [:repo_discover, :cancel_repo_discover]
268
+ },
269
+ :resource_type => 'Katello::Product'
270
+ @plugin.permission :destroy_products,
271
+ {
272
+ 'katello/api/v2/products' => [:destroy],
273
+ 'katello/api/v2/repositories' => [:destroy],
274
+ 'katello/api/v2/products_bulk_actions' => [:destroy_products],
275
+ 'katello/api/v2/repositories_bulk_actions' => [:destroy_repositories],
276
+ 'katello/api/v2/package_groups' => [:destroy]
277
+ },
278
+ :resource_type => 'Katello::Product'
279
+ @plugin.permission :sync_products,
280
+ {
281
+ 'katello/api/v2/products' => [:sync],
282
+ 'katello/api/v2/repositories' => [:sync],
283
+ 'katello/api/v2/products_bulk_actions' => [:sync_products],
284
+ 'katello/api/v2/repositories_bulk_actions' => [:sync_repositories],
285
+ 'katello/api/v2/sync' => [:index],
286
+ 'katello/api/v2/sync_plans' => [:sync],
287
+ 'katello/sync_management' => [:index, :sync_status, :product_status, :sync, :destroy]
288
+ },
289
+ :resource_type => 'Katello::Product'
290
+ @plugin.permission :export_products,
291
+ {
292
+ 'katello/api/v2/repositories' => [:export]
293
+ },
294
+ :resource_type => 'Katello::Product'
295
+ end
296
+
297
+ def subscription_permissions
298
+ @plugin.permission :view_subscriptions,
299
+ {
300
+ 'katello/api/v2/subscriptions' => [:index, :show, :available, :manifest_history, :auto_complete_search],
301
+ 'katello/api/v2/repository_sets' => [:index, :show, :available_repositories]
302
+ },
303
+ :resource_type => 'Katello::Subscription'
304
+ @plugin.permission :attach_subscriptions,
305
+ {
306
+ 'katello/api/v2/subscriptions' => [:create]
307
+ },
308
+ :resource_type => 'Katello::Subscription'
309
+ @plugin.permission :unattach_subscriptions,
310
+ {
311
+ 'katello/api/v2/subscriptions' => [:destroy]
312
+ },
313
+ :resource_type => 'Katello::Subscription'
314
+ @plugin.permission :import_manifest,
315
+ {
316
+ 'katello/products' => [:available_repositories, :toggle_repository],
317
+ 'katello/providers' => [:redhat_provider, :redhat_provider_tab],
318
+ 'katello/api/v2/subscriptions' => [:upload, :refresh_manifest],
319
+ 'katello/api/v2/repository_sets' => [:enable, :disable]
320
+ },
321
+ :resource_type => 'Katello::Subscription'
322
+ @plugin.permission :delete_manifest,
323
+ {
324
+ 'katello/api/v2/subscriptions' => [:delete_manifest]
325
+ },
326
+ :resource_type => 'Katello::Subscription'
327
+ end
328
+
329
+ def sync_plan_permissions
330
+ @plugin.permission :view_sync_plans,
331
+ {
332
+ 'katello/api/v2/sync_plans' => [:index, :show, :add_products, :remove_products, :available_products, :auto_complete_search],
333
+ 'katello/api/v2/products' => [:index]
334
+ },
335
+ :resource_type => 'Katello::SyncPlan'
336
+ @plugin.permission :create_sync_plans,
337
+ {
338
+ 'katello/api/v2/sync_plans' => [:create]
339
+ },
340
+ :resource_type => 'Katello::SyncPlan'
341
+ @plugin.permission :edit_sync_plans,
342
+ {
343
+ 'katello/api/v2/sync_plans' => [:update]
344
+ },
345
+ :resource_type => 'Katello::SyncPlan'
346
+ @plugin.permission :destroy_sync_plans,
347
+ {
348
+ 'katello/api/v2/sync_plans' => [:destroy]
349
+ },
350
+ :resource_type => 'Katello::SyncPlan'
351
+ end
352
+
353
+ def user_permissions
354
+ @plugin.permission :my_organizations,
355
+ {
356
+ 'katello/api/rhsm/candlepin_proxies' => [:list_owners]
357
+ },
358
+ :public => true
359
+ end
360
+ end
361
+ end