EZP-22045: Inject appropriate user in repository when in legacy_mode