add_relationship and views_join
I found the solution

        $join = new views_join();
        $join-&gt;table = 'users_roles';
        $join-&gt;field = 'uid';
        $join-&gt;left_table = 'node';
        $join-&gt;left_field = 'uid';
        $join-&gt;type = 'left';

        $query-&gt;add_relationship('users_roles', $join, 'node');
        $query-&gt;add_where(1,'users_roles.rid','4' ,'=');


This works