Hey Frank,

2 ways to do it:

First, you could use the peer_method parameter under the list settings
to specify what method on the peer is used to select the users
(default doSelect, could be changed to doSelectForUser for example,
and in that method you filter based on the current user). This would
be pretty bad style though, since you don't want to put view/user
specific filters into the model layer.

The better way to do it is to overwrite the addFiltersCriteria method
in the autogenerated actions class (trust me, it is there to be
modified, don't rely on the generator.yml for everything). In that
method, just call the parent method, and add the appropriate
requirement to the criteria it returns, based on what user is logged
in. Should be 3-4 lines of code... done. Seems elegant to me.

Hope this helps,
Daniel



On Mar 17, 5:45 am, Frank He <[email protected]> wrote:
> Yes, I know that.
> But I want to take advantage of admin generator, which is using
> generator.yml and no need to write action manually. But it seemed I can not
> control what data to display, what not just by using the simple backend
> admin generator. Do you think so?
>
> On Tue, Mar 17, 2009 at 4:40 AM, Tomasz Ignatiuk
> <[email protected]>wrote:
>
>
>
> > If a sale can have access only to his clients and no one else has
> > (other sales) except admin, you can add to client rows a sales id.
> > Then when sales is logged in where data is taken to list in backend
> > etc change the action in order to get only those clients whose sales
> > id is the one who is logged in.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to