[ARVADOS] updated: c00bae55176bf193fe2f69d0c271184eb494cb09

git at public.curoverse.com git at public.curoverse.com
Mon Apr 28 13:53:50 EDT 2014


Summary of changes:
 .../v1/api_client_authorizations_controller.rb     |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

       via  c00bae55176bf193fe2f69d0c271184eb494cb09 (commit)
      from  9f7a232bbdce6e1640012c0cca87862b5c1be4f4 (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 c00bae55176bf193fe2f69d0c271184eb494cb09
Author: Brett Smith <brett at curoverse.com>
Date:   Mon Apr 28 13:54:26 2014 -0400

    api: Style improvements in auth controller.
    
    Refs #1904.

diff --git a/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb b/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
index 3daeae2..dc95b2f 100644
--- a/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
+++ b/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
@@ -42,24 +42,26 @@ class Arvados::V1::ApiClientAuthorizationsController < ApplicationController
     # Here we are deliberately less helpful about searching for client
     # authorizations.  We look up tokens belonging to the current user
     # and filter by exact matches on api_token and scopes.
-    wanted_scopes = [@where.andand['scopes']]
+    wanted_scopes = []
     if @filters
       wanted_scopes.concat(@filters.map { |attr, operator, operand|
         ((attr == 'scopes') and (operator == '=')) ? operand : nil
       })
+      @filters.select! { |attr, operator, operand|
+        (attr == 'uuid') and (operator == '=')
+      }
+    end
+    if @where
+      wanted_scopes << @where['scopes']
+      @where.select! { |attr, val| attr == 'uuid' }
     end
-    @where.andand.select! { |attr, val| attr == 'uuid' }
-    @filters.andand.select! { |attr, operator, operand|
-      (attr == 'uuid') and (operator == '=')
-    }
     @objects = model_class.
       includes(:user, :api_client).
       where('user_id=?', current_user.id)
     super
     wanted_scopes.compact.each do |scope_list|
-      @objects = @objects.select { |auth|
-        (auth.scopes & scope_list) == (auth.scopes | scope_list)
-      }
+      sorted_scopes = scope_list.sort
+      @objects = @objects.select { |auth| auth.scopes.sort == sorted_scopes }
     end
   end
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list