Merge branch '1578-api-server-in-docker'
[arvados.git] / services / api / app / controllers / arvados / v1 / nodes_controller.rb
index 52f8e9da5e956a4f781d9ef54b569d84ddc2a626..f85eceac0e1ed3f9f296714160f04f87513a7361 100644 (file)
@@ -1,5 +1,5 @@
 class Arvados::V1::NodesController < ApplicationController
-  skip_before_filter :login_required, :only => :ping
+  skip_before_filter :require_auth_scope_all, :only => :ping
 
   def create
     @object = Node.new
@@ -17,4 +17,14 @@ class Arvados::V1::NodesController < ApplicationController
                    ec2_instance_id: params[:instance_id] })
     show
   end
+
+  def find_objects_for_index
+    if current_user.andand.is_admin || !current_user.andand.is_active
+      super
+    else
+      # active non-admin users can list nodes that are (or were
+      # recently) working
+      @objects = model_class.where('last_ping_at >= ?', Time.now - 1.hours)
+    end
+  end
 end