Repository navigation
users.previous_accounts and users.merge - #6
Merged
Merged
Conversation
Someone deleted who signs in again now gets a fresh account (a new id). users.previous_accounts(id) lists their earlier, deleted accounts, and users.merge(id, from:) merges one into the live account: roles, object roles, passkeys, MFA methods and unused backup codes move over, meta and attributes merge (the live account wins), history stays on the old account. Merging the same account twice is an APIError with code already_merged. Unit tests against the fake API, a README entry and a CHANGELOG line. The live suite signs a test identity in, gives it a role, deletes it, signs in again (a new id, the old one 404), lists and merges the old account (the role moves over, a second merge is already_merged), and checks that someone deactivated and then deleted is refused at sign-in (403 account_deactivated): 78 examples, 0 failures, 1 pending against scute-api-v2 v24.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Someone deleted who signs in again now gets a fresh account with a new id. This adds the admin side, mirroring the JS SDK's
previousAccounts/mergeUser.SDK
users.previous_accounts(id)lists the user's earlier, deleted accounts, newest first. Each hasid,status,created_at,deleted_at,merged_into(once merged), the number of roles and passkeys, and its MFA methods.users.merge(id, from:)merges one of those into the live account.{ "user_id", "merged", "moved" => { "roles" => n, ... } }. Merging the same account twice is anAPIErrorwith codealready_merged.already_mergedand an unknown account.Live suite
previous_accountslists the old account with its role.mergemoves the role over (a check now allows), the old account showsmerged_into, and a second merge isalready_merged.403 account_deactivated).Results
bundle exec rake liveagainst scute-api-v2 v24: 78 examples, 0 failures, 1 pending. The pending one is a skip: scute-ruby has no local decision engine for the policy snapshot.After the run, the suite's app has no users, agents, properties or policy left, and its settings are back to their defaults.