DRY up "acting as" code

Pulled out the common logic for switching between users to the
Edition::AuditTrail class. Note that the use of a class-level
attr_accessor in AudditTrail is not thread-safe. Using Thread.current
would be a better solution, especially if we ever intend to use
something like sidekiq for processing background jobs.