Merge branch '16809-s3-v4-signature'
[arvados.git] / services / api / app / models / api_client_authorization.rb
index ab6fd8000c1f4a966be7e01450402719f7182d5a..518fe569377ab1b2c2b21880e4f3411aa340844a 100644 (file)
@@ -268,12 +268,14 @@ class ApiClientAuthorization < ArvadosModel
       end
 
       act_as_system_user do
-        if user.is_active && !remote_user['is_active']
+        if (user.is_active && !remote_user['is_active']) or (user.is_invited && !remote_user['is_invited'])
+          # Synchronize the user's "active/invited" state state.  This
+          # also saves the record.
           user.unsetup
+        else
+          user.save!
         end
 
-        user.save!
-
         # We will accept this token (and avoid reloading the user
         # record) for 'RemoteTokenRefresh' (default 5 minutes).
         # Possible todo: