Seeking for a better solution to restrict access in GRUB2 menu

Okay I found that variables in /etc/default/grub are read and exported by grub-mkconfig in /usr/sbin/. The following patch is what I had in mind and hopefully complies with quality requirements and coding standards for the files modified. Patch for 30_os-prober should be similar and hopefully follows tomorrow.

As explained above the variables should be defined in /etc/default/grub like so GRUB_PWRESTRICTION_LINUX="--users user1" or so GRUB_PWRESTRICTION_LINUX="--unrestricted".

I'm looking forward to your feedback.

--- /usr/sbin/grub-mkconfig-orig    2013-10-19 11:22:56.653129020 +0200
+++ /usr/sbin/grub-mkconfig 2013-10-19 11:49:34.961392887 +0200
@@ -230,6 +230,12 @@
   GRUB_ENABLE_CRYPTODISK \
   GRUB_BADRAM \
   GRUB_RECORDFAIL_TIMEOUT
+  GRUB_PWRESTRICTION_LINUX \
+  GRUB_PWRESTRICTION_OS_PROBER_LINUX \
+  GRUB_PWRESTRICTION_OS_PROBER_WINDOWS \
+  GRUB_PWRESTRICTION_OS_PROBER_MACOSX \
+  GRUB_PWRESTRICTION_OS_PROBER_EFI \
+  GRUB_PWRESTRICTION_OS_PROBER_HURD

 if test "x${grub_cfg}" != "x"; then
   rm -f "${grub_cfg}.new"
--- /etc/grub.d/10_linux-orig   2013-10-19 23:28:50.195071600 +0200
+++ /etc/grub.d/10_linux    2013-10-19 23:40:17.429375336 +0200
@@ -120,9 +120,17 @@
      title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
      grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
       fi
-      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+      if [ x"${GRUB_PWRESTRICTION_LINUX}" != x ]; then
+        echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} "${GRUB_PWRESTRICTION_LINUX}" \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+      else
+        echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+      fi
   else
-      echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+      if [ x"${GRUB_PWRESTRICTION_LINUX}" != x ]; then
+        echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} "${GRUB_PWRESTRICTION_LINUX}" \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+      else
+        echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+      fi
   fi      
   echo "recordfail" | sed "s/^/$submenu_indentation/"
   if [ x$type != xrecovery ] ; then
@@ -320,7 +328,11 @@
    boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
     fi
     # TRANSLATORS: %s is replaced with an OS name
-    echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
+    if [ x"${GRUB_PWRESTRICTION_LINUX}" != x ]; then
+      echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' "${GRUB_PWRESTRICTION_LINUX}" \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
+    else
+      echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
+    fi
   fi

   linux_entry "${OS}" "${version}" advanced \