Thread local database sessions.
Fixed rollback function to use correct session.
require_perm function and /<user_id>/domains route