Modified: trunk/app/models/workflow.rb (3742 => 3743)
--- trunk/app/models/workflow.rb 2013-10-04 14:45:58 UTC (rev 3742)
+++ trunk/app/models/workflow.rb 2013-10-04 14:49:17 UTC (rev 3743)
@@ -31,6 +31,8 @@
has_many :workflow_ports, :dependent => :destroy
has_many :semantic_annotations, :as => :subject, :dependent => :destroy
has_many :curation_events, :as => :object
+ has_many :pack_entries, :as => :contributable, :class_name => 'PackContributableEntry'
+ has_many :packs, :through => :pack_entries
before_validation :check_unique_name
before_validation :apply_extracted_metadata
@@ -433,4 +435,8 @@
tags.any? { |t| t.name == 'component' }
end
+ def component_families
+ self.packs.select { |p| p.component_family? }
+ end
+
end
Modified: trunk/lib/api/resources/workflows.rb (3742 => 3743)
--- trunk/lib/api/resources/workflows.rb 2013-10-04 14:45:58 UTC (rev 3742)
+++ trunk/lib/api/resources/workflows.rb 2013-10-04 14:49:17 UTC (rev 3743)
@@ -202,3 +202,19 @@
{ :xml => doc }
end
+
+def component_families(ob, user, query)
+
+ families_node = LibXML::XML::Node.new('component-families')
+
+ ob.component_families.each do |family|
+ if Authorization.check('view', family, user)
+ family_node = LibXML::XML::Node.new('component-family')
+ family_node << rest_resource_uri(family)
+
+ families_node << family_node
+ end
+ end
+
+ families_node
+end