Support custom subclasses of the User model

Provide API supporting custom model classes extending the built-in User
model.

Move most of `UserRepository` to `UserRepositoryBase<U>`, where `U`
is the generic User subclass.

Implement `UserRepository` as a thin wrapper extending
`UserRepositoryBase<User>`.