Add capability to “Editor” role to be able to view all users attachments

As far as I know there’s no standard capabilities just for attachments. You’d need edit_posts.

function add_theme_caps() {
    $role = get_role( 'editor' );
    $role->add_cap( 'edit_others_posts' ); 
}
add_action( 'admin_init', 'add_theme_caps');

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)