Tunability of the critical-current density in superconductor-ferromagnet hybrids