Reputation: 269
So, I am just a totally normal, everyday, boring human being who happens to be learning UML a the moment. I'd like to start out by saying that my problem isn't applied to a real situation, it is an exercise.
It says the following "each principal is the boss of one school, and each school has one principal". So far, so good with the multiplicity. The problems for me start arising with this statement "The principal must also be an administrator". How am I supposed to model that? I'm currently leaning towards a ternary association, but it doesn't seem very clear to me (probably because I am relatively new at this).
I've modeled it like this so far:
Any ideas?
All help is greatly appreciated and paid back in kind with cosmic love rays. Basically I'll think about how great you are for helping me while dropping a deuce.
Upvotes: 0
Views: 333
Reputation: 1789
A simple solution is to not mix functionalities and rights. I mean, you have a classe User which get a Role. The Role is just a list of String, one string per role.
And each functionalities is associated with the list of needed roles to use the functionalities. The first step of a functionality is to test that the connected user gets the role needed to use the functionality.
And in a professional environment, users are managed through an LDAP (id Active Directory), each user gets a password and a set of roles. And it is not needed to have one class per role.
Could your "homework" be done in this way ? (if look on stackoverflow, you will find others questions related to this topic).
By the way, the word extend on your schema is not needed: the chosen arrow means generalization which the UML modelization of an extend.
Upvotes: 1