17119: Merge branch 'master' into 17119-add-filter-groups
[arvados.git] / apps / workbench / app / controllers / user_agreements_controller.rb
index 8dd34b1957d922e439c80d48ebcc19b3100674f1..bdfaa240335922e3b616bf4c10d791f34ded70ac 100644 (file)
@@ -1,11 +1,25 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 class UserAgreementsController < ApplicationController
+  skip_before_action :check_user_agreements
+  skip_before_action :find_object_by_uuid
+  skip_before_action :check_user_profile
+
+  def index
+    if unsigned_user_agreements.empty?
+      redirect_to(params[:return_to] || :back)
+    end
+  end
+
   def model_class
     Collection
   end
 
   def sign
     params[:checked].each do |checked|
-      if r = checked.match(/^([0-9a-f]+)/)
+      if (r = CollectionsHelper.match_uuid_with_optional_filepath(checked))
         UserAgreement.sign uuid: r[1]
       end
     end