(In reply to David's tweet - answer too long for twitter!.... and twitlonger 
makes the sentences wrap too much....)
__________________________________________________________
David's question:
@kierankelleher would you mind showing me an example of how it is used? It 
sounds like something that could be used with D2W for permissions


__________________________________________________________
@daveeed 

For example, in one of my apps, the User entity has a "customersQualifier()" 
method that returns a qualifier appropriate to the Role of the user that 
qualifies the user's access to Customer objects in the system. The Qualifier is 
constructed differently for customer users, inside sales, sysadmin, graphic 
design, etc. The qualifier itself is based on Customer attributes and in itself 
is useful only for fetches against the Customer entity. 

Now let's say I have Barcoded Coupons on Mailers, and someone is scanning 
Coupon redemptions into a web form for tracking and reporting of advertizement 
effectiveness and let's say I want to make sure that the person scanning has 
access to the customer that is related to those coupons. And in this scenario, 
let's say the relationship keyPath from Coupon Entity to Customer Entity is 
like this:

coupon -> mailer.campaign.program.location.customer

So when the coupon ID is scanned in and submitted, I can create a Qualifier for 
the Coupon based on the ID, and then I need an auxiliary security qualifier to 
ensure the logged in user has access to the related Customer so I would do sth 
like these steps:

EOQualifier qCoupon = Coupon.XKEY_SERIAL_ID.eq( scannedCouponID );
EOQualifier qCustomer = currentUser.customerQualifier();

// Since qCustomer qualifies Customer entities and we want to qualify the 
Coupon that we are fetching based on
// the user's restricted access to a specific set of Customer EOs... prefix the 
customer qualifier to make it a coupon qualifier
// that restricts the fetch to coupons related to the customers that this user 
has access to....
qCustomer = ERXPrefixQualifierTraversal.prefixQualifierWithKey( 
"mailer.campaign.program.location.customer" );

EOQualifier qFinal = ERXQ.and( qCoupon, qCustomer );

Coupon c = ( fetch with qualifier 'qFinal' )


I hope that explains the usage of ERXPrefixQualifierTraversal better ....

Regards, Kieran
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to