With this snippet you can restrict the WordPress dashboard to administrator roles user only.