Re: [webobjects-newbies] Adding a user and permissions
Re: [webobjects-newbies] Adding a user and permissions
- Subject: Re: [webobjects-newbies] Adding a user and permissions
- From: Art Isbell <email@hidden>
- Date: Fri, 11 Apr 2003 09:47:13 -1000
On Friday, April 11, 2003, at 07:20 AM, Martin Hofmann wrote:
I can't answer your question about 3 tables, but this may be of
interest.
I did a similar thing,but rather than have 3 tables and link, I had 2
tables, USERS and APPLICATIONS. I then added a permissions field to
the link table APPLICATIONUSER, so that each user/application
combination is associated with a permission.
I modeled the same scenario as above except that I needed each
ApplicationUser to be able to have multiple permissions, so I created a
Permissions entity as Jevon has done and created an
ApplicationUser.permissions to-many relationship. I considered his
3-entity join model as well but rejected it because I first wanted to
check whether the current user could access the app. To do this, I
checked whether one and only one ApplicationUser object exists where
ApplicationUser.user = currentUser and ApplicationUser.application =
currentApplication. If so, then I set the permissions to be
ApplicationUser.permissions.
But I don't see why a 3-entity join wouldn't work. You'd need
ApplicationUserPermission to be a concrete (non-abstract) entity
because you need to be able to access ApplicationUserPermission objects
in your app. To add ApplicationUserPermissions, create a new one and
set its application relationship to currentApplication, its user
relationship to currentUser, and its permission relationship to
currentPermission. If multiple permissions are possible, you'd need to
create one ApplicationUserPermission object for each permission which
seems a little less ideal than the model I chose.
In both models, you would delete the flattened to-many relationships
across the join entity and make the relationships between the join and
other entities class properties because you need to access the join
entity. You can't set both the flattened and underlying relationships
to be class properties.
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.