3

Let's say I have different functionalities/roles the admin can give to the users of their choice, so there is no "if the user can do this they can't do that". Example : I have the roles : read, add , delete and edit. The admin can assign these roles to his/her users, let's say randomly (for the lack of a better word). Can this be illustrated in use case diagram or I should just use one actor and give him all these actions ? If it can be done then how ? And I am not familiar with all UML diagrams but I would be thankful if someone knows a better diagram where this can be illustrated better!

S.Eruka
  • 31
  • 1
  • 3

2 Answers2

2

Usecase diagram seems to be a good idea in your case but you have to learn more about them... Here is a simple example where an user is able to read and the admin is able to read (because he is also an user) and write.

enter image description here

Once again try to find more info about UML/usecase diagrams

Red Beard
  • 3,436
  • 1
  • 14
  • 17
  • You should make the blurry use cases a bit more specific by naming them `Read something` and `Write something`. Just a verb is not enough. – qwerty_so Apr 12 '16 at 10:47
  • Umm I am not sure you're getting my question I am not talking about generalization relationship between actors! As I said I wanted a correct way to show the roles that are assigned to different actors, when I can't tell what actor can have what role ! – S.Eruka Apr 12 '16 at 12:00
  • 1
    The Actors ARE the roles. And this answer is addressing this. Like on the theatre actors play roles. – qwerty_so Apr 12 '16 at 13:41
  • I think when I tried to give a simple example I ended up giving an ambiguous one :/ But anyway I got your point ! Thank you :) – S.Eruka Apr 12 '16 at 20:03
2

Well first off, it's generally better to give your roles nouns for names rather than verbs. Just makes things clearer. So reader, adder, etc.

In terms of use cases, I'd say create one use case for "assign role to user", with admin as the actor. You probably don't need four separate use cases unless the processes involved in adding the different roles are radically different from one another.

Then, create "read stuff", "add stuff", etc with reader and adder, respectively, as actors.

In your descriptions of the reader and adder actors, make it clear that these are users which have been assigned the respective roles. If you like, they can inherit from a more generic "user" actor, but whether that's motivated in your case I can't tell from this question alone.

That's all you need to do, really.

Uffe
  • 10,396
  • 1
  • 33
  • 40
  • Umm thanks for your answer , I get the point of it! If I wanted to go by this way , and add actors for every role ( Reader , Adder ..) I get that I can't show the generalization relationship between the actors right ? Because the "Editor" for example can be an "Adder" at the same time ! – S.Eruka Apr 12 '16 at 12:08
  • You can if you want, but Reader and Adder won't be generalizations of each other (though possibly of a third actor, User). You simply describe Reader as "a user with read permission" and Adder as "a user with Add permission". There's no need to explain that a *person* who has both permissions can be active in both use cases, that's the beauty of using *roles* as actors. – Uffe Apr 12 '16 at 14:24