Semi-automorphisms of rings