Added a check for required user permissions.