Module: Katello::Authorization::Product::ClassMethods
- Defined in:
- app/models/katello/authorization/product.rb
Instance Method Summary collapse
- #deletable ⇒ Object
- #editable ⇒ Object
- #readable ⇒ Object
- #readable? ⇒ Boolean
- #readable_repositories(repo_ids = nil) ⇒ Object
- #syncable ⇒ Object
- #syncable? ⇒ Boolean
Instance Method Details
#deletable ⇒ Object
34 35 36 |
# File 'app/models/katello/authorization/product.rb', line 34 def deletable (:destroy_products) end |
#editable ⇒ Object
30 31 32 |
# File 'app/models/katello/authorization/product.rb', line 30 def editable (:edit_products) end |
#readable ⇒ Object
26 27 28 |
# File 'app/models/katello/authorization/product.rb', line 26 def readable (:view_products) end |
#readable? ⇒ Boolean
42 43 44 |
# File 'app/models/katello/authorization/product.rb', line 42 def readable? ::User.current.can?(:view_products) end |
#readable_repositories(repo_ids = nil) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/models/katello/authorization/product.rb', line 46 def readable_repositories(repo_ids = nil) query = Katello::Repository.all if repo_ids query = query.where(:id => repo_ids) end query.joins(:product) .joins(:content_view_version) .where("#{Katello::ContentViewVersion.table_name}.content_view_id" => Katello::ContentView.default.pluck(:id)) .where(:product_id => Katello::Product.readable.pluck(:id)) end |
#syncable ⇒ Object
38 39 40 |
# File 'app/models/katello/authorization/product.rb', line 38 def syncable (:sync_products) end |
#syncable? ⇒ Boolean
59 60 61 |
# File 'app/models/katello/authorization/product.rb', line 59 def syncable? ::User.current.can?(:sync_products) end |