I need to limit the data returned in actionIndex

I am working on a roster maintenance application and I’d like to limit the viewing of data in the database to the users own data. In the actionIndex in the controller.php file I see the following code:

		$dataProvider=new CActiveDataProvider('FcarcMembers');





Is there any way I can modify the data being select to include a condition such as select * from members where <the user id of this logged in user> = <the id field in members> ?

Or is there somewhere else better to apply that condition. I also need to over ride that condition when the user is an administrator.



Yea… just look at the example on CActiveDataProvider:


You can do it inline like it has there or pass a CDbCriteria to the data provider. There are other good examples in the demos folder (function "search()"):


The code produced by gii includes these criteria as well and are also good examples.

Thanks, that looks like it’ll work.