public function hasRole($id, $role)
    {
        if (!$user = $this->getUser($id)) {
            return false;
        }

        return in_array($role, $user['roles']);
    }
public function hasRole($id, $role)
    {
        if (!$user = $this->getUser($id)) {
            return false;
        }

        return in_array($role, $user['roles']);
    }
public function hasRole ( $ id , $ role ) { if ( ! $ user = $ this -> getUser ( $ id ) ) { return false ; } return in_array ( $ role , $ user [ 'roles' ] ) ; }
Check if a certain user has a specific role.

@param string|int $id
@param string     $role

@return bool
Check if a certain user has a specific role .