This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » User management plugins » sfGuard, groups & sfWidgetFormPropelSelect
sfGuard, groups & sfWidgetFormPropelSelect [message #59591] Thu, 28 August 2008 01:02
Tocpe  is currently offline Tocpe
Messages: 1
Registered: August 2008
Junior Member
I'm hoping one of the wiser and more experienced Symfony experts will be kind enough to help me with this.

Running Symfony 1.1 with the new forms.

I am able to pull up a list of users into the sfWidgetFormPropelSelect, but I'd like to be able to "filter out" certain groups.

For example, I have 4 groups: Admin, SuperUsers, Associates & Customers.
sf_Guard_User  Table (condensed)
ID | Their name/access
1    admin
2    Superuser
3    Associate
4    Customer


sf_Guard_Group  Table
ID | Description
1    admin
2    superuser
3    associate
4    customer


I have a page where a user can create a support ticket. If the person viewing this page has an access level above customer, they can select who to assign the ticket to.

- All users (including customers) are in the sf_Guard_User table.
- In the sf_Guard_Group table I have set up the 4 levels of access and the sf_Guard_User_Group table has linked these together.
sf_Guard_User_Group   Table
user_id | group_id
1         1
2         2
3         3
4         4


And both permission tables appear the same as the group tables.

I have tried the following code in the TicketForm.class.php file to control my form results when creating/editing a ticket:

In the $this->setWidgets(array(... section
'assignedto'    => new sfWidgetFormPropelSelect(array('model' => 'sfGuardUser', 'add_empty' => false)),


And just below the setWidgets secion:
$assignedtoCriteria = new Criteria;
$assignedtoCriteria->add(sfGuardUserGroupPeer::GROUP_ID, '4', Criteria::NOT_EQUAL);

$this->widgetSchema['assignedto']->setOption('criteria', $assignedtoCriteria);


I'm trying to filter out the customers from the "assigned to" pull down. While no errors are thrown, no filtering is taking place either. What am I missing?
Previous Topic:Disable Generator
Next Topic:[RESOLVED] sfGuard login and extjs
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software