added permissions check for allowing printing