16387: Allow batch update to set is_active=false for a remote user.
[arvados.git] / services / api / app / controllers / arvados / v1 / users_controller.rb
index d9ab5556ffc9ac7826abda00bc18e3d4b700269c..62da35ae86a626486b37e2c0943e65e0b1dfb75f 100644 (file)
@@ -54,7 +54,10 @@ class Arvados::V1::UsersController < ApplicationController
       @object = current_user
     end
     if not @object.is_active
-      if not (current_user.is_admin or @object.is_invited)
+      if @object.uuid[0..4] != Rails.configuration.ClusterID
+        logger.warn "Remote user #{@object.uuid} called users.activate"
+        raise ArgumentError.new "cannot activate remote account"
+      elsif not (current_user.is_admin or @object.is_invited)
         logger.warn "User #{@object.uuid} called users.activate " +
           "but is not invited"
         raise ArgumentError.new "Cannot activate without being invited."