4 title: "Migrating a user to a federated account"
7 Copyright (C) The Arvados Authors. All rights reserved.
9 SPDX-License-Identifier: CC-BY-SA-3.0
12 When you use federation capabilities to connect two or more clusters that were already operating, some users might already have accounts on multiple clusters. Typically, they will want to choose a single account on one of the clusters and abandon the rest, transferring all data or permissions from their old “remote” accounts to a single “home” account.
14 This effect can be achieved by changing the UUIDs of the user records on the remote clusters. This should be done before the user has ever used federation features to access cluster B with cluster A credentials. Otherwise, see "managing conflicting accounts" below.
16 For example, a user might have:
17 * an account A on cluster A with uuid @aaaaa-tpzed-abcdefghijklmno@, and
18 * an account B on cluster B with uuid @bbbbb-tpzed-lmnopqrstuvwxyz@
20 An administrator at cluster B can merge the two accounts by renaming account B to account A.
23 <pre><code>#!/usr/bin/env python
25 arvados.api('v1').users().update_uuid(
26 uuid="<span class="userinput">bbbbb-tpzed-lmnopqrstuvwxyz</span>",
27 new_uuid="<span class="userinput">aaaaa-tpzed-abcdefghijklmno</span>").execute()
28 </code></pre></notextile>
30 This should be done when the user is idle, i.e., not logged in and not running any jobs or containers.
32 h2. Managing conflicting accounts
34 If the user has already used federation capabilities to access cluster B using account A before the above migration has been done, this will have already created a database entry for account A on cluster B, and the above program will error out. To fix this, the same "update_uuid API call":../api/methods/users.html#update_uuid can be used to move the conflicting account out of the way first.
37 <pre><code>#!/usr/bin/env python
41 random_chars = ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(15))
42 arvados.api('v1').users().update_uuid(
43 uuid="<span class="userinput">aaaaa-tpzed-abcdefghijklmno</span>",
44 new_uuid="bbbbb-tpzed-"+random_chars).execute()
45 </code></pre></notextile>
47 After this is done and the migration is complete, the affected user should wait 5 minutes for the authorization cache to expire before using the remote cluster.