I would use a role pattern.
User <<->> Role
You should even be able to make a rule qualifier like
user.roles.name contains "Vendor"
Ramsey
On Aug 13, 2013, at 11:19 AM, Theodore Petrosky wrote:
> I have been playing with D2W and I may have boxed myself into a corner.
>
> A User is of a type. a User can be a Vendor or a Client or a Worker. So I
> thought that I would create an attribute 'userType' in User. I wanted to
> have a Vendor tab and a Client tab and I have it mostly working.
>
> when I create a ListVendorPage:
>
> public WOComponent listVendorAction() {
>
> EOEditingContext ec = ERXEC.newEditingContext();
> ListPageInterface lpi = (ListPageInterface)
> D2W.factory().listPageForEntityNamed("AppUser", session());
>
> EODatabaseDataSource ds = new EODatabaseDataSource(ec, "AppUser");
>
> ERXFetchSpecification<AppUser> fs =
> new ERXFetchSpecification<AppUser>(AppUser.ENTITY_NAME,
> AppUser.IS_ACTIVE.eq(true).and(AppUser.USER_TYPE.eq("Vendor")), null);
>
> ds.setFetchSpecification(fs);
>
> lpi.setDataSource(ds);
>
> ((D2WComponent) lpi).d2wContext().takeValueForKey("ListVendor",
> "navigationState");
> ((D2WComponent) lpi).d2wContext().takeValueForKey("Vendor",
> "userTypeKey");
>
> return (D2WPage) lpi;
> }
>
> I am also adding that userTypeKey so I can target rules like this:
>
> 100 : (pageConfiguration = 'ListAppUser' and userTypeKey = 'Vendor') =>
> displayNameForPageConfiguration = "Vendor List"
> [com.webobjects.directtoweb.Assignment]
>
> Maybe there is a better way? If I select to edit a Vendor, I wanted rules:
>
> 100 : (pageConfiguration = 'EditAppUser' and userTypeKey = 'Vendor') =>
> navigationState = "ListVendor" [com.webobjects.directtoweb.Assignment]
> 100 : (pageConfiguration = 'EditAppUser' and userTypeKey = 'admins') =>
> navigationState = "ListAdmins" [com.webobjects.directtoweb.Assignment]
>
> then I thought that what I should be using is inheritance. Vendor inherits
> from User, Administrators inherit from User. In the past, I would have
> created a User with boolean attributes for Vendor, Client, Employee, Admin.
> After all a user can be both an employee and a vendor.
>
> How are youse guys doing this?
>
> Ted
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]