Module: Katello::Authorization::Repository::ClassMethods
- Defined in:
- app/models/katello/authorization/repository.rb
Instance Method Summary collapse
- #deletable ⇒ Object
- #editable ⇒ Object
- #exportable ⇒ Object
- #readable ⇒ Object
- #readable_as(user) ⇒ Object
- #readable_docker_catalog ⇒ Object
- #readable_docker_catalog_as(user) ⇒ Object
- #syncable ⇒ Object
Instance Method Details
#deletable ⇒ Object
54 55 56 |
# File 'app/models/katello/authorization/repository.rb', line 54 def deletable in_product(Katello::Product.(:destroy_products)) end |
#editable ⇒ Object
62 63 64 |
# File 'app/models/katello/authorization/repository.rb', line 62 def editable in_product(Katello::Product.editable) end |
#exportable ⇒ Object
50 51 52 |
# File 'app/models/katello/authorization/repository.rb', line 50 def exportable in_product(Katello::Product.exportable) end |
#readable ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/models/katello/authorization/repository.rb', line 24 def readable in_products = Repository.in_product(Katello::Product.(:view_products)).select(:id) in_environments = Repository.where(:environment_id => Katello::KTEnvironment.(: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) joins(:root).where("#{Repository.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 |
#readable_as(user) ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/models/katello/authorization/repository.rb', line 32 def readable_as(user) in_products = Repository.in_product(Katello::Product.(user, :view_products)).select(:id) in_environments = Repository.where(:environment_id => Katello::KTEnvironment.(user, :view_lifecycle_environments)).select(:id) in_content_views = Repository.joins(:content_view_repositories).where("#{ContentViewRepository.table_name}.content_view_id" => Katello::ContentView.readable_as(user)).select(:id) in_versions = Repository.joins(:content_view_version).where("#{Katello::ContentViewVersion.table_name}.content_view_id" => Katello::ContentView.readable_as(user)).select(:id) joins(:root).where("#{Repository.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 |
#readable_docker_catalog ⇒ Object
40 41 42 |
# File 'app/models/katello/authorization/repository.rb', line 40 def readable_docker_catalog readable_docker_catalog_as(User.current) end |
#readable_docker_catalog_as(user) ⇒ Object
44 45 46 47 48 |
# File 'app/models/katello/authorization/repository.rb', line 44 def readable_docker_catalog_as(user) table_name = Repository.table_name in_unauth_environments = Repository.joins(:environment).where("#{Katello::KTEnvironment.table_name}.registry_unauthenticated_pull" => true).select(:id) Repository.readable_as(user).or(Repository.joins(:root).where("#{table_name}.id in (?)", in_unauth_environments)).non_archived.docker_type end |