Authorization to view/list by record in collections?

Authorization to view/list by record in collections?

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


mercule posted on Thursday, March 01, 2007

I'm just starting out using CSLA, so bear with me if this is an easy one:

I'll frame this in terms of the ProjectTracker sample, for consistancy.  There are different categories of projects, not all of which are publicly viewable.  In a given listing, some roles should be able to see all, while several others each only see a subset.  Is there an easy way to apply this to the ProjectList class?

All the examples I'm seeing look like they'd throw an error if someone pulled up a listing that included records that they weren't authorized to view.  I just want them hidden.  Any ideas?

JoeFallon1 replied on Thursday, March 01, 2007

You add q new Shared method anda new CriteriaRole class to the BO so you can pass the criteria thru the DataPortal and then act on it.

So you could have a RoleID as your critieria and pass that string to a new class named CriteriaRole which passes it to the DP.

There you determine which type of criteria was passed (Criteria or CriteriaRole) and branch accordingly.

Eventually you pass the RoleID to a SP or a SQL statement and you only retrieve those projects for that RoleID.

Joe

 

Copyright (c) Marimer LLC