I'm trying to design UML Analysis Class Diagram for a college project. My UML Diagram looks like this:
I have encountered two different problems:
- User can have multiple roles. A user with Manager role can manage other users and their roles. How to illustrate this association in UML?
- User uses SwipeCard to access a room. How to show this association in UML?
You have a really good start to an analysis model. Some things I would do:
User
andRole
(or make it an association class) calledRole Assignment
.Manager
authorizesRole Assignment
andRole Assignment
authorized byManager
.Here's an example first cut, off the top of my head:
I left off a bunch of stuff, including operations, which I would suppress for validation with SMEs. I can't do all the work for you!
Re 1:
these are the methods to manipulate roles and
shows how the manager uses them. The constraint tells that only the manager may use this method.
Short Quick Answer
Make the
Role
class, not theManager
class.Long Boring Answer
I had a similar case, but, eventually, had a similar
Manager
class, and later add aMiddleManager
class that could also manage other classes.So, I move a function or properties
canManage()
to theRole
class.As @Thomas Kilian mention, your question is more a behaviour feature, than a structural feature. Behaviors are represented as methods or properties, in a class diagram.
UPDATE:
Another version may include a self referenced association.