Characterizing rings in terms of the extent of the injectivity and projectivity of their modules