コード例 #1
0
 /**
  *
  * @access public
  * @param  \Symfony\Component\Security\Core\User\UserInterface $user
  * @param  string                                              $role
  * @return bool
  */
 public function hasRole(UserInterface $user, $role)
 {
     foreach ($this->availableRoles as $aRoleKey => $aRole) {
         if ($user->hasRole($aRoleKey)) {
             if (in_array($role, $aRole) || $role == $aRoleKey) {
                 return true;
             }
         }
     }
     return false;
 }