Sha256: 5955c9a315f8e8dd3a1aca3a3255e0d68660f6ec41409286e35bb03f2dd38a1f
Contents?: true
Size: 1.47 KB
Versions: 4
Compression:
Stored size: 1.47 KB
Contents
module Katello module Authorization::Repository extend ActiveSupport::Concern delegate :editable?, to: :product def deletable? product.editable? && !promoted? end def redhat_deletable? !self.promoted? && self.product.editable? end def readable? self.class.readable.where("#{self.class.table_name}.id" => self.id).any? end delegate :syncable?, to: :product module ClassMethods def readable in_products = Repository.where(:product_id => Katello::Product.authorized(:view_products)).select(:id) in_environments = Repository.where(:environment_id => Katello::KTEnvironment.authorized(:view_lifecycle_environments)).select(:id) in_content_views = Repository.joins(:content_view_repositories).where("#{ContentViewRepository.table_name}.content_view_id" => Katello::ContentView.readable).select(:id) in_versions = Repository.joins(:content_view_version).where("#{Katello::ContentViewVersion.table_name}.content_view_id" => Katello::ContentView.readable).select(:id) where("#{self.table_name}.id in (?) or #{self.table_name}.id in (?) or #{self.table_name}.id in (?) or #{self.table_name}.id in (?)", in_products, in_content_views, in_versions, in_environments) end def deletable where(:product_id => Katello::Product.authorized(:destroy_products)) end def syncable where(:product_id => Katello::Product.authorized(:sync_products)) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems