Sha256: 30ec8484147699871ef18373b6bf9ffc9150af46901d38a563d21dbf4fe2a786
Contents?: true
Size: 1.36 KB
Versions: 126
Compression:
Stored size: 1.36 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 module ClassMethods def readable authorized(: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 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
126 entries across 126 versions & 1 rubygems