isAuthenticated() public method

Check if user is already authenticated.
public isAuthenticated ( ) : boolean
return boolean True if user is authenticated, otherwise false.
Esempio n. 1
0
 /**
  * This function gets the current user object and needs to validate its access against the required roles.
  * The function must either return ACCESS_GRANTED, ACCESS_ABSTAIN or ACCESS_DENIED.
  *
  * @param AbstractUser $user           Current user instance.
  * @param array        $requestedRoles An array of requested roles for the current access map.
  *
  * @return integer ACCESS_GRANTED, ACCESS_ABSTAIN or ACCESS_DENIED.
  */
 public function vote(AbstractUser $user, array $requestedRoles)
 {
     $result = self::ACCESS_DENIED;
     if ($user->isAuthenticated()) {
         $result = self::ACCESS_GRANTED;
     }
     return $result;
 }