Re: Qualifier for toMany "is empty" / "all contained in"
Re: Qualifier for toMany "is empty" / "all contained in"
- Subject: Re: Qualifier for toMany "is empty" / "all contained in"
- From: James Cicenia <email@hidden>
- Date: Mon, 9 Aug 2010 07:44:08 -0500
I had something similar to this... I wound up creating two separate queries and using NSet to union them.
James
On Aug 9, 2010, at 7:11 AM, Timo Hoepfner wrote:
> Hi,
>
> I'm required to add some sort of optional access control to articles in an online shop. The idea is to add a "requiredPermissions" toMany relationship from the "Article" entity to a "Permission" entity (Article <<->> Permission).
>
> Articles that have no restriction don't have any permissions assigned, so the relationship is empty.
>
> The list of permission EOs available to a user is determined at runtime. At the time the query is executed, I have them in an NSArray that can be passed into the qualifier. Let's call this "grantedPermissions".
>
> So the problem boils down to fetching Articles that:
>
> 1. Either have an empty "requiredPermissions" relationship OR
> 2. all of the "requiredPermissions" of the Article are contained in the "grantedPermissions" list passed into the qualifier
>
> I saw several questions regarding the first part on the list in the last years, but couldn't find a good answer.
> The second part would be easy if I needed to qualify on ANY of "requiredPermissions" instead of ALL of them. (Or if the article needed to match all of the "grantedPermissions", not the other way around.)
>
> Any thoughts?
>
> Thanks for your help!
>
> Timo
>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden