Natürlich können Sie.
die Benutzerinformationen zu verwalten, bietet sfBasicSecurityUser mehrere Methoden:
// Add one or more credentials
$user->addCredential('foo');
$user->addCredentials('foo', 'bar');
// Check if the user has a credential
echo $user->hasCredential('foo'); => true
// Check if the user has both credentials
echo $user->hasCredential(array('foo', 'bar')); => true
// Check if the user has one of the credentials
echo $user->hasCredential(array('foo', 'bar'), false); => true
// Remove a credential
$user->removeCredential('foo');
echo $user->hasCredential('foo'); => false
// Remove all credentials (useful in the logout process)
$user->clearCredentials();
echo $user->hasCredential('bar'); => false
Quelle: Practical symfony - day 13 - The User
In Ihrer Aktion, die Sie Zugriff auf das Benutzerobjekt haben mit einem getUser() -Methode:
$user = $this->getUser();
Haben Sie eine Lösung gefunden? – ownking