Hi

I'm using the sfGuard plugin and would like to know how I get a list
of users that are have a specific permission or are members of a group
that has that permission.

Firstly I have implemented the http://trac.symfony-project.org/ticket/4227
enhancement from rogelio2k as I agree that the sfGuardUser
hasPermission() method should check user+group permissions.

In my action I would like to do something like this:

[CODE]
public function executeAdmins()
{
  $this->users = sfGuardUserPeer::retrieveByPermission('admin');
}
[/CODE]

At the moment I'm doing this:

[CODE]
public function executeAdmins()
{
  $c = new Criteria();
  $users = sfGuardUserPeer::doSelect($c);

  $this->users = array();

  foreach ($users as $user)
  {
    if ($user->hasPermission('admin'))
    {
      $this->users[] = $user;
    }
  }
}
[/CODE]

Has anyone written a sfGuardUserPeer::retrieveByPermission() or
similar method?

...or am I overlooking something here?  Is there a better way of doing
this?

Any help would be much appreciated :)

Many thanks in advance, Matthew
--~--~---------~--~----~------------~-------~--~----~
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