Module: Katello::Authorization::Repository::ClassMethods

Defined in:
app/models/katello/authorization/repository.rb

Instance Method Summary collapse

Instance Method Details

#deletableObject



31
32
33
# File 'app/models/katello/authorization/repository.rb', line 31

def deletable
  where(:product_id => Katello::Product.authorized(:destroy_products))
end

#readableObject



24
25
26
27
28
29
# File 'app/models/katello/authorization/repository.rb', line 24

def readable
  in_products = Repository.where(:product_id => Katello::Product.authorized(:view_products)).pluck(:id)
  in_content_views = Repository.joins(:content_view_repositories).where("#{ContentViewRepository.table_name}.content_view_id" => Katello::ContentView.readable).pluck(:id)
  in_versions = Repository.joins(:content_view_version).where("#{Katello::ContentViewVersion.table_name}.content_view_id" => Katello::ContentView.readable).pluck(:id)
  where("#{self.table_name}.id in (?) or #{self.table_name}.id in (?) or #{self.table_name}.id in (?)", in_products, in_content_views, in_versions)
end

#syncableObject



35
36
37
# File 'app/models/katello/authorization/repository.rb', line 35

def syncable
  where(:product_id => Katello::Product.authorized(:sync_products))
end