Development

#2237 (No Connection parameter ($con) for addGroupByName($name) and add PermissionByName($name))

You must first sign up to be able to contribute.

Ticket #2237 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

No Connection parameter ($con) for addGroupByName($name) and add PermissionByName($name)

Reported by: Tartembouille Assigned to: fabien
Priority: minor Milestone:
Component: sfGuardPlugin Version: 1.0.0
Keywords: Cc:
Qualification:

Description

The sfGuardPlugin API seems not to be complete. addGroupByName($name) and add PermissionByName?($name) methods don't have a connection parameter, for exemple to start a transaction before calling this methods (which call a save() method and so interract with database).

So a quick fix for all methods calling save() shoulde be :

  public function addPermissionByName($name, $con = null)
  {
    $permission = sfGuardPermissionPeer::retrieveByName($name);
    if (!$permission)
    {
      throw new Exception(sprintf('The permission "%s" does not exist.', $name));
    }

    $up = new sfGuardUserPermission();
    $up->setUserId($this->getId());
    $up->setPermissionId($permission->getId());

    $up->save($con);
  }

Change History

09/13/07 12:31:41 changed by Tartembouille

The problem occurs in the class sfGuardSecurityUser too :

class sfGuardSecurityUser extends sfBasicSecurityUser
{
  public function addGroupByName($name)
  {
    return $this->getGuardUser()->addGroupByName($name);
  }

09/13/07 23:32:45 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

in r5075