I am using symfony 1.2, and I am generating the backend admin by this
method
symfony propel-init-admin backend article Article
I want to control access based on various cridentials, so I overwrite
the code in action like this:
protected function addFiltersCriteria($c)
{
if($c==null) $c=new Criteria();
if($this->getUser()->hasCredential("sales")){
$c->addJoin(PaymentsPeer::USER_ID,UsersPeer::ID);
$crit=UsersPeer::genSalesCriteria($c,$this->getUser()-
>getAttribute("internal_user_code"));
if($crit!=null){
$c->add($crit);
}
}
parent::addFiltersCriteria($c);
}
In listing, it works fine, and only that sales' record is being
displayed.
BUT during creating/edit, it is wrong, all the users are listed, no
matter if they belong to this sales or not. I would see
addFiltersCriteria is ONLY applicable for listing, and not for editing/
Creating.
Maybe I set userID in payments table as foreign key to users, and when
symfony is displaying that fields, it is using object_select_tag to
select all the users in a select tag.
Any solution to restrict only limited uses for that particular sales
to be displayed in that select tag?
If no, I want to hide Create button and make that only applicable to
admin. But unfortunatey, I can not find any way in generator.yml to
hide create button, can anyone shed a light on that?
Thanks for your help.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---