I am not sure if your analysis is quite correct.  The Group(1)-User(*) relationship is not quite correct, since User might want to be in two groups at the same time.  For example, John can be in the group of Chemistry Professor, as well as Substitute Teacher.  Your relationship implies that a user can ONLY be in 1 group.  Similarly, your relationships to the Role imply that the same Role cannot be shared among various entities.
 
In fact, most of the relationships are N-to-N type of relationships.  A User CAN be in more than one Group, and the same Role CAN be applied to more than 1 User/Group.  
 
So here is my suggestion:
 
1. Dump either Class or Group
2. Assuming you dump Class, add a parent/children relationships to Group as in Group(1)-Group(*), to indicate that one parent group can contain multiple children groups.
3. Add a Group(*)-Role(*) relationship to indicate that a group can have many roles and a single role can be in many groups
4. Add a User(*)-Role(*) relationship to indicate that a user can have multiple roles, and a role can accommodate many users
5. Finally, add a Group(*)-User(*) relationship to indicate that a user can be a part of many groups and a group can contain many users
 
Your Group will contain a method called getRoles() as well as getAllRoles() which would scan up the Group tree and return a set of all the Roles assigned.  Finally, your user would have a method called getRoles() and getAllRoles() to return just the roles assigned directly to the user, or all the roles that the user has access to through the assignment to a Group(s) or otherwise.
 
You can also keep a side entity called UserRole which would be maintained as you change the Group/User/Role relationships dynamically.  This will allow you to quickly answer the question isInRole(User, Role).
 
This can be done with OrionServer.
 
-AP_
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of George Mardale
Sent: Monday, October 01, 2001 8:29 AM
To: Orion-Interest
Cc: [EMAIL PROTECTED]
Subject: Design strategy

Hi everybody,
 
During our last application design, I have encountered the following issue and I don't know if Orion can handled it in a specific manner:
 
I have a hierarchy of users that consists of 3 levels: Class, Group, User. A class can contain one or more groups, a group can contain one or more users. For instance, an instance of Class can be "professor", an instance of Group can be "chemistry professor", and an instance of User can be "John" (John is a chemistry professor). We have 1..* relationship for each of the 3 levels. Of course, these are entity beans. Furthermore, we have another entity bean, called Role. The ideea is that every User can have a Role in an application  (for instance, John can be a SystemAdmin in an application), but also, a Group or a Class can have one or more Roles (instead of assigning a Role to every User in a Group or a Class, we assign the Role to the whole Group or Class, saving a lot of time this way, thus all the User in the respective Group or Class will have that Role). For all the Roles, we need to keep the id of the person(s) to whom the Role was assigned. But only at run-time I can find out the type of the component in the user hierarchy (either Class, Group, or User), to which the role has been assigned. In other words, an attribute in class Role has to store a value that is sometimes an instance of Class, sometimes an instance of Group and sometimes an instance of User.
 
Analyzing this issue, we came along with this diagram:
 
                        1        *
Abstract being    ---------- Role
            |  inherits
--------------------------
|            |            |
|            |            |
Class    Group    User
1 ------- *      1----- *
 
How can we achieve this in Orion? Is it possible?
 
Thank you for your time,
best regards,
George.
 

Reply via email to