Child Authorization Rules

Child Authorization Rules

Old forum URL: forums.lhotka.net/forums/t/5746.aspx


Slayer posted on Thursday, November 06, 2008

Hi All

I have gone through a lot of csla.net sample code. Is it possible to add Authorization rules to collection objects?

Eg.

If i have a parent object which contains a collection of child objects, how would one authorize a user to add or remove child objects from the collection ? Or is this a sign of a bad object model?

Thanks

ajj3085 replied on Thursday, November 06, 2008

Well, one thing is to make sure to properly Set AllowAdd, AllowEdit, and AllowDelete on the BLB subclass.  Also, you'll want to override RemoveItem and InsertItem, I believe.  You'll have to throw exceptions here.  The child to be contained in the BLB must also add it's own authorization rules so that properties on the child instance can't be changed.


Copyright (c) Marimer LLC