Restrict WordPress Media Library for a specific user role (users can only see/select own media)

add this to your functions.php or in a snippet, with this code the users with role external will only see their own uploads, any other role will see them all just has before.

add_filter( 'ajax_query_attachments_args', 'role_external' );
function role_external( $query ) {
    $user_id = get_current_user_id();
    if ( $user_id && current_user_can('external') ) {
        $query['author'] = $user_id;
    }
    return $query;
}