How to show a admin bar menu item only to users with certain capabilities?

The check will be called too early if you just write it in your plugin file like this:

if ( current_user_can( 'add_movies' ) ) {
    add_action( 'admin_bar_menu', 'wpse17689_admin_bar_menu' );
}
function wpse17689_admin_bar_menu( &$wp_admin_bar )
{
    $wp_admin_bar->add_menu( /* ... */ );
}

Because it will execute when your plugins is loaded, which is very early in the startup process.

What you should do is always add the action, but then in the callback for the action check for current_user_can(). If you can’t do the action, just return without adding the menu item.

add_action( 'admin_bar_menu', 'wpse17689_admin_bar_menu' );
function wpse17689_admin_bar_menu( &$wp_admin_bar )
{
    if ( ! current_user_can( 'add_movies' ) ) {
        return;
    }
    $wp_admin_bar->add_menu( /* ... */ );
}