Webiny\Component\Security\User\AbstractUser::hasRole PHP Method

hasRole() public method

Check if current user has the defined role.
public hasRole ( string $role ) : boolean
$role string Role name
return boolean True if user has the role, otherwise false.
    public function hasRole($role)
    {
        foreach ($this->roles as $roleObj) {
            if ($role == $roleObj->getRole()) {
                return true;
            }
        }
        return false;
    }