Restricting access to specific administration pages on a wordpress multisite installation

That’s a really long title… but the answer is short.
I have a WordPress Multisite installation and I want to restrict access to some “areas” of the administration to allow only certain user roles to access them. So inspired from a piece of code here: http://codex.wordpress.org/Plugin_API/Action_Reference/admin_init I wrote this little snippet:
if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/widgets.php'){ wp_redirect(admin_url() ); exit; }
What this does is allow only users with the manage_network ability (thus just the superadmin) to access the wp-admin/widgets.php page. If anyone else tries to access that url, they will be redirected to the /wp-admin area (the redirection is done in this part of the code: wp_redirect(admin_url() );)

Of course you can combine a lot of those snippets in a plugin or your functions.php file.

For example this is a somewhat extreme situation below, restricting access to a lot of regions in the administration area:

function restrict_admin_with_redirect() {
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/widgets.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/user-new.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/upgrade-functions.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/upgrade.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/theme-install.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/theme-editor.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/setup-config.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/plugins.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/plugin-install.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options-writing.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options-reading.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options-privacy.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options-permalink.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options-media.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options-head.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options-general.php.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options-discussion.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/options.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/network.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/ms-users.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/ms-upgrade-network.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/ms-themes.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/ms-sites.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/ms-options.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/ms-edit.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/ms-delete-site.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/ms-admin.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/moderation.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/menu-header.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/menu.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/edit-tags.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/edit-tag-form.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/edit-link-form.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/edit-comments.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/credits.php'){ wp_redirect(admin_url() ); exit; }
	if (!current_user_can('manage_network') && $_SERVER['PHP_SELF'] == '/wp-admin/about.php'){ wp_redirect(admin_url() ); exit; }
}

add_action('admin_init', 'restrict_admin_with_redirect');