(#9862) Promote user/group logic to first class

Some core logic of the setting, which is how to manage the user and
group, was hidden inside obtuse if conditions. This tries to make it
clearer what is happening, at the expense of being longer, by promoting
the different values available for owner and group to classes that can
contain the logic for how to deal with that particular value.