lib/katello/plugin.rb in katello-3.5.2 vs lib/katello/plugin.rb in katello-3.6.0.rc1

- old
+ new

@@ -1,37 +1,21 @@ require 'katello/permission_creator' Foreman::Plugin.register :katello do requires_foreman '>= 1.16' - sub_menu :top_menu, :content_menu, :caption => N_('Content'), :after => :monitor_menu do + sub_menu :top_menu, :content_menu, :caption => N_('Content'), + :icon => 'fa fa-book', :after => :monitor_menu do menu :top_menu, - :environments, - :caption => N_('Lifecycle Environments'), - :url => '/lifecycle_environments', - :url_hash => {:controller => 'katello/api/v2/environments', - :action => 'index'}, - :engine => Katello::Engine, - :turbolinks => false - menu :top_menu, :red_hat_subscriptions, :caption => N_('Red Hat Subscriptions'), :url => '/subscriptions', :url_hash => {:controller => 'katello/api/v2/subscriptions', :action => 'index'}, :engine => Katello::Engine, :turbolinks => false - menu :top_menu, - :activation_keys, - :caption => N_('Activation Keys'), - :url => '/activation_keys', - :url_hash => {:controller => 'katello/api/v2/activation_keys', - :action => 'index'}, - :engine => Katello::Engine, - :turbolinks => false - divider :top_menu, :parent => :content_menu menu :top_menu, :redhat_provider, :caption => N_('Red Hat Repositories'), :url_hash => {:controller => 'katello/providers', :action => 'redhat_provider'}, @@ -54,62 +38,63 @@ :url_hash => {:controller => 'katello/api/v2/gpg_keys', :action => 'index'}, :engine => Katello::Engine, :turbolinks => false - divider :top_menu, :parent => :content_menu menu :top_menu, + :sync_plans, + :caption => N_('Sync Plans'), + :url => '/sync_plans', + :url_hash => {:controller => 'katello/api/v2/sync_plans', + :action => 'index'}, + :engine => Katello::Engine, + :turbolinks => false + + menu :top_menu, :sync_status, :caption => N_('Sync Status'), :url_hash => {:controller => 'katello/sync_management', :action => 'index'}, :engine => Katello::Engine, :turbolinks => false + divider :top_menu, :caption => N_('Lifecycle'), :parent => :content_menu + menu :top_menu, - :sync_plans, - :caption => N_('Sync Plans'), - :url => '/sync_plans', - :url_hash => {:controller => 'katello/api/v2/sync_plans', + :environments, + :caption => N_('Lifecycle Environments'), + :url => '/lifecycle_environments', + :url_hash => {:controller => 'katello/api/v2/environments', :action => 'index'}, :engine => Katello::Engine, :turbolinks => false - divider :top_menu, :parent => :content_menu menu :top_menu, :content_views, :caption => N_('Content Views'), :url => '/content_views', :url_hash => {:controller => 'katello/api/v2/content_views', :action => 'index'}, :engine => Katello::Engine, :turbolinks => false - divider :top_menu, :parent => :content_menu menu :top_menu, - :errata, - :caption => N_('Errata'), - :url => '/errata', - :url_hash => {:controller => 'katello/api/v2/errata', + :activation_keys, + :caption => N_('Activation Keys'), + :url => '/activation_keys', + :url_hash => {:controller => 'katello/api/v2/activation_keys', :action => 'index'}, :engine => Katello::Engine, :turbolinks => false - menu :top_menu, - :packages, - :caption => N_('Packages'), - :url => '/packages', - :url_hash => {:controller => 'katello/api/v2/packages', - :action => 'index'}, - :engine => Katello::Engine, - :turbolinks => false + divider :top_menu, :caption => N_('Content Types'), :parent => :content_menu menu :top_menu, - :puppet_modules, - :caption => N_('Puppet Modules'), - :url => '/puppet_modules', - :url_hash => {:controller => 'katello/api/v2/puppet_modules', + :debs, + :caption => N_('Deb Packages'), + :url => '/debs', + :url_hash => {:controller => 'katello/api/v2/debs', :action => 'index'}, :engine => Katello::Engine, :turbolinks => false menu :top_menu, @@ -120,10 +105,19 @@ :action => 'index'}, :engine => Katello::Engine, :turbolinks => false menu :top_menu, + :errata, + :caption => N_('Errata'), + :url => '/errata', + :url_hash => {:controller => 'katello/api/v2/errata', + :action => 'index'}, + :engine => Katello::Engine, + :turbolinks => false + + menu :top_menu, :files, :caption => N_('Files'), :url => '/files', :url_hash => {:controller => 'katello/api/v2/file_units', :action => 'index'}, @@ -136,21 +130,39 @@ :url => '/ostree_branches', :url_hash => {:controller => 'katello/api/v2/ostree_branches', :action => 'index'}, :engine => Katello::Engine, :turbolinks => false + + menu :top_menu, + :packages, + :caption => N_('Packages'), + :url => '/packages', + :url_hash => {:controller => 'katello/api/v2/packages', + :action => 'index'}, + :engine => Katello::Engine, + :turbolinks => false + + menu :top_menu, + :puppet_modules, + :caption => N_('Puppet Modules'), + :url => '/puppet_modules', + :url_hash => {:controller => 'katello/api/v2/puppet_modules', + :action => 'index'}, + :engine => Katello::Engine, + :turbolinks => false end menu :top_menu, :content_hosts, :caption => N_('Content Hosts'), :url => '/content_hosts', :url_hash => {:controller => 'api/v2/hosts', :action => 'index'}, :engine => Katello::Engine, :parent => :hosts_menu, - :after => :hosts, + :after => :newhost, :turbolinks => false menu :top_menu, :host_collections, :caption => N_('Host Collections'), @@ -160,10 +172,19 @@ :engine => Katello::Engine, :parent => :hosts_menu, :after => :content_hosts, :turbolinks => false + menu :labs_menu, + :experimental_ui, + :url => '/xui', + :url_hash => {:controller => 'katello/react', + :action => 'index'}, + :caption => N_('Content Experimental UI'), + :parent => :lab_features_menu, + :turbolinks => false + allowed_template_helpers :subscription_manager_configuration_url search_path_override("Katello") do |resource| "/#{Katello::Util::Model.model_to_controller_path(resource)}/auto_complete_search" end apipie_documented_controllers ["#{Katello::Engine.root}/app/controllers/katello/api/v2/*.rb"] @@ -242,24 +263,32 @@ 'foreman_tasks/api/tasks/callback should have a permission that grants access', 'bastion/bastion/index should have a permission that grants access', 'bastion/bastion/index_ie should have a permission that grants access' ]) - in_to_prepare do - add_controller_action_scope(HostsController, :index) do |base_scope| - base_scope - .preload(:content_view, :lifecycle_environment, :subscription_facet) - .preload(content_facet: [:bound_repositories, :content_view, :lifecycle_environment]) - end + add_controller_action_scope(HostsController, :index) do |base_scope| + base_scope + .preload(:content_view, :lifecycle_environment, :subscription_facet) + .preload(content_facet: [:bound_repositories, :content_view, :lifecycle_environment]) + end - add_controller_action_scope(Api::V2::HostsController, :index) do |base_scope| - base_scope - .preload(:content_view, :lifecycle_environment, :subscription_facet) - .preload(content_facet: [:bound_repositories, :content_view, :lifecycle_environment]) - end + add_controller_action_scope(Api::V2::HostsController, :index) do |base_scope| + base_scope + .preload(:content_view, :lifecycle_environment, :subscription_facet) + .preload(content_facet: [:bound_repositories, :content_view, :lifecycle_environment]) end register_info_provider Katello::Host::InfoProvider Katello::PermissionCreator.new(self).define add_all_permissions_to_default_roles + + role 'Register hosts', [ + :view_hostgroups, :view_activation_keys, :view_hosts, + :create_hosts, :edit_hosts, :destroy_hosts, + :view_content_views, :view_gpg_keys, :view_subscriptions, + :attach_subscriptions, :view_host_collections, + :view_organizations, :view_lifecycle_environments, :view_products, + :view_locations, :view_domains, :view_architectures, + :view_operatingsystems + ] end