Question

As an exercise, I would like to create a forum in Java EE, using JSF.

I'm a total nooby in class diagram.

I can't figure out if I need to create a class for the administrators.

For example, having a class User, then the admin class by inheritance. In that way, admins could do everything users do. But my issue is that I want different level of admin. Let's say, moderator, super admin etc... So I could create a role attribute saying which rights within the admin he has.

But in that case, is it useful to create an admin class, I could just make a user class with this role attribute which will say if user or admin and which admin etc.

I'm a bit lost.

Was it helpful?

Solution

Why do you need a different class? The most usual approach is just have a User class (call it something else because many DB don't like it), and each user have several Roles or Permissions.

That said, most probably you should not deal with this from within your application. Use the JAAS model and let the container deal with; your only use in the application could be assigning roles to users.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top