2011-01-05 6 views

답변

0

물론 가능합니다.

사용자 자격 증명을 관리하려면, sfBasicSecurityUser는 여러 가지 방법을 제공합니다

// 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 

출처 : 액션에서 Practical symfony - day 13 - The User

당신이 인 getUser() 메서드를 사용하여 사용자 개체에 액세스 할 수 있습니다

$user = $this->getUser(); 
관련 문제