Sha256: 00264830fcb9e726739334a9956fcef061e8d490bedf07a34b4a46531071b453
Contents?: true
Size: 1.89 KB
Versions: 4
Compression:
Stored size: 1.89 KB
Contents
module Katello module Authorization::ContentView extend ActiveSupport::Concern include Authorizable def readable? authorized?(:view_content_views) end def editable? authorized?(:edit_content_views) end def deletable? authorized?(:destroy_content_views) end def publishable? authorized?(:publish_content_views) end def promotable_or_removable? authorized?(:promote_or_remove_content_views) && Katello::KTEnvironment.any_promotable? end def exportable? authorized?(:export_content_views) end module ClassMethods def readable authorized(:view_content_views) end def creatable authorized(:view_content_views) end def importable? creatable? && publishable? end def readable_as(user) authorized_as(user, :view_content_views) end def readable? ::User.current.can?(:view_content_views) end def editable authorized(:edit_content_views) end def deletable authorized(:destroy_content_views) end def publishable authorized(:publish_content_views) end def promotable_or_removable return where("1=0") unless Katello::KTEnvironment.any_promotable? authorized(:promote_or_remove_content_views) end def exportable authorized(:export_content_views) end def readable_repositories(repo_ids = nil) query = Katello::Repository.all content_views = Katello::ContentView.readable if repo_ids query.where(:id => repo_ids) else content_views = content_views.where(:default => false) end query.joins(:content_view_version) .where("#{Katello::ContentViewVersion.table_name}.content_view_id" => content_views.pluck(:id)) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems