app/models/katello/authorization/content_view_version.rb in katello-3.18.0.rc2.1 vs app/models/katello/authorization/content_view_version.rb in katello-3.18.0
- old
+ new
@@ -8,12 +8,35 @@
:lifecycle_environment => lifecycle_environment)
total_hosts.count == authorized_hosts.count
end
module ClassMethods
+ def with_content_view_scope(scope)
+ joins(:content_view).merge(Katello::ContentView.send(scope))
+ end
+
def readable
- view_ids = ::Katello::ContentView.readable.collect { |v| v.id }
- joins(:content_view).where("#{Katello::ContentView.table_name}.id" => view_ids)
+ with_content_view_scope(:readable)
+ end
+
+ def exportable
+ with_content_view_scope(:exportable)
+ end
+
+ def editable
+ with_content_view_scope(:editable)
+ end
+
+ def publishable
+ with_content_view_scope(:publishable)
+ end
+
+ def deletable
+ with_content_view_scope(:deletable)
+ end
+
+ def promotable_or_removable
+ with_content_view_scope(:promotable_or_removable)
end
end
end
end