Generic User Management conflicts with Rich Domain Model
i'm interested on your opinions on this. Maybe it's a trivial question,
maybe not. At least i did not find satisfying answers for the last two days ;)
I'm trying to create a generic user management for my app(s). I built a
domain model (for the user management), a DAO Layer (using
HibernateDaoSupport), a thin "Service Layer" that basically combines
cross cutting DAO layer calls (to rolesDao, groupsDao, etc). Virtually
everything is coded to interfaces (except the MVC stuff).
I have a central User domain-object that implements IUser and describes
the very basic user-account of the system (name, password, fullname,
passwordhint, roles, etc.). So far so good, everything fine.
Now i want to use the user management in a application that requires to
have more domain-model data attached to the user object (imagine:
language, timezone, Contacts, calculateShippingTo() and the like). My
thinking was to create a interface say "IMyUser" that extends my generic
IUser. The resulting implementation "User implementes IUser, IMyUser"
is mapped with Hibernate and represents the domain object User for my
This approach "cripples" my user management to a set of interfaces
basically all to be implemented in the appliction. Though that is what i
don't want to do for each app. Now, my ultimate goal is, that my user
stuff is totally independent from the domain model of the application. So i
can store my generic user data i.e. in a different database and the like.
Any hints of how to approach this? Do i need to externalize the user
management and communicate via messaging? This would result in sort
of a shadow user in my app that carries a reference to a real user.
I'd really appreciate your thoughts and hints.