Redirecting non-logged in users trying to view Group pages but not the Group directory

It looks like bp_is_group() is “does the current page belong to a single group” (as opposed to bp_is_groups_directory()):

/*** Redirect non logged-in users to registration page if they visit a profile page or a group page other than the groups directory ***/
function gwangi_bp_logged_out_page_template_redirect()
{
    if( ! is_user_logged_in() && ( bp_is_user() || bp_is_group() ) ) {
        wp_redirect( home_url( '/register/' ) );
        exit();
    }
}
add_action( 'template_redirect', 'gwangi_bp_logged_out_page_template_redirect' );

There’s more bp_is_* functions in src/bp-core/bp-core-template.php.