[ARVADOS] updated: a10ff78a14eae5d13dc49ca382ed22fbc2c11d1a
Git user
git at public.curoverse.com
Fri Jul 1 12:03:36 EDT 2016
Summary of changes:
.../controllers/arvados/v1/groups_controller.rb | 29 +++++++++++-----------
1 file changed, 14 insertions(+), 15 deletions(-)
via a10ff78a14eae5d13dc49ca382ed22fbc2c11d1a (commit)
from b9f14b6879bf41c023e60867db17c25437f3653b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit a10ff78a14eae5d13dc49ca382ed22fbc2c11d1a
Author: radhika <radhika at curoverse.com>
Date: Fri Jul 1 12:03:13 2016 -0400
9498: improve filter check
diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb
index 453feda..a1bfb8b 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -63,10 +63,19 @@ class Arvados::V1::GroupsController < ApplicationController
request_filters = @filters
- [Group,
+ klasses = [Group,
Job, PipelineInstance, PipelineTemplate, ContainerRequest,
Collection,
- Human, Specimen, Trait].each do |klass|
+ Human, Specimen, Trait]
+
+ table_names = klasses.map(&:table_name)
+ request_filters.each do |col, op, val|
+ if col.index('.') && !table_names.include?(col.split('.', 2)[0])
+ raise ArgumentError.new("Invalid attribute '#{col}' in filter")
+ end
+ end
+
+ klasses.each do |klass|
# If the currently requested orders specifically match the
# table_name for the current klass, apply that order.
# Otherwise, order by recency.
@@ -86,20 +95,10 @@ class Arvados::V1::GroupsController < ApplicationController
@filters = request_filters.map do |col, op, val|
if !col.index('.')
[col, op, val]
+ elsif (col = col.split('.', 2))[0] == klass.table_name
+ [col[1], op, val]
else
- cs = col.split('.')
- if cs.size != 2 || cs[0] == "" || cs[1] == ""
- raise ArgumentError.new("Invalid attribute '#{col}' in filter")
- elsif cs[0] == klass.table_name
- [cs[1], op, val]
- else
- begin
- cs[0].classify.constantize
- nil
- rescue
- raise ArgumentError.new("Invalid attribute '#{col}' in filter")
- end
- end
+ nil
end
end.compact
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list