Repository navigation
Migration guide to version 3.0.0 #28
Locked
enjaku4
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Veri v3.0.0 includes several breaking changes. This guide helps you migrate your app from Veri v2.x.x.
If you're new to Veri, simply install the latest version and follow the README instructions.
Database Migration
Run this migration, replacing
userswith your user table name if it's different:This migration updates the database to be compatible with Veri v3. It changes the
user_agentcolumn type totext, renames thelockedandlocked_atcolumns, and adds an algorithm marker to each stored password hash.Account Locking Renamed to Suspension
Account locking is now called suspension, because
lock!overrode Active Record's row locking method of the same name. Replace any usages of the old methods with their new counterparts:user.lock!user.suspend!user.unlock!user.unsuspend!user.locked?user.suspended?User.lockedUser.suspendedUser.unlockedUser.unsuspendedlockedcolumnsuspendedcolumnlocked_atcolumnsuspended_atcolumnThe behavior is unchanged.
Sessions Terminated on Password Update
update_passwordnow terminates all of the user's sessions, including the current one. To keep the user signed in, log them in again or opt out of session termination:Session as the Source of Truth for the Tenant
The tenant is now passed to
log_in, andcurrent_tenantis a method provided by Veri that returns the tenant of the current session. Remove yourcurrent_tenantoverride and pass the tenant when logging in:Veri no longer looks up the session within a tenant, so a session from one tenant is also found on requests for another. If your application relied on that isolation, update its logic to enforce it.
Declaring Tenant Models
Models used as tenants must now be declared with
veri_tenant. Without the declaration,log_in,switch_tenant,shapeshift,in_tenant, andin_original_tenantraiseVeri::InvalidTenantErrorwhen given a record of that model:Destroying a record of a declared model also deletes its sessions, including the impersonating sessions that return to it. If your app terminated these sessions itself before destroying a tenant, you can remove that code.
All reactions