myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3774] trunk/lib/api/resources/components.rb: Fix


From: noreply
Subject: [myexperiment-hackers] [3774] trunk/lib/api/resources/components.rb: Fixed issue with deleting component families which contain deleted resources
Date: Mon, 11 Nov 2013 09:16:09 +0000 (UTC)

Revision
3774
Author
fbacall
Date
2013-11-11 09:16:09 +0000 (Mon, 11 Nov 2013)

Log Message

Fixed issue with deleting component families which contain deleted resources

Modified Paths

Diff

Modified: trunk/lib/api/resources/components.rb (3773 => 3774)


--- trunk/lib/api/resources/components.rb	2013-11-11 09:12:31 UTC (rev 3773)
+++ trunk/lib/api/resources/components.rb	2013-11-11 09:16:09 UTC (rev 3774)
@@ -223,7 +223,9 @@
   end
 
   # Check if can delete ALL components in family
-  component_entries = family.contributable_entries.select { |e| e.contributable_type == 'Workflow' && e.contributable.component? }
+  component_entries = family.contributable_entries.select { |e| e.contributable_type == 'Workflow' &&
+                                                                !e.contributable.nil? &&
+                                                                e.contributable.component? }
   components = component_entries.map { |e| e.contributable }
   undeletable_components = components.select { |c| !Authorization.check('destroy', c, opts[:user]) }
   if undeletable_components.size == 0
@@ -235,7 +237,9 @@
 
     rest_get_request(family, opts[:user], opts[:query])
   else
-    family.errors.add_to_base("You don't have permission to delete #{undeletable_components.size} components in this component family.")
+    family.errors.add_to_base(
+      "You don't have permission to delete #{undeletable_components.size} components in this component family: " +
+      "#{undeletable_components.map { |c| rest_access_uri(c) }.join(', ')}")
     rest_response(401, :object => family)
   end
 end

reply via email to

[Prev in Thread] Current Thread [Next in Thread]