cloudprint-service
cloudprint-service copied to clipboard
Passing user email address to CUPS
Is there any possibility of adding the ability to pass the email address of the Google user printing a document to CUPS and using that email in place of the local linux user account that is running the cloudprint service? I'm testing different Google Cloud print solutions in a School District with a large number of Chromebooks, and have CUPS set up to print to an ipp printer on a print server. That print server logs all print jobs (Username, Time/Date, Job Name, etc), and I would like CUPS to pass the Google account email to that for the username. I think the regular Google Cloud Print connector has this functionality with the "cups_job_full_username" parameter (Unless I'm misunderstanding that parameter). Until recently we have been using a Lantronix xPrintServer Cloud Print device to do this, but it's been more unstable than I'd like. I know with that, I can pass the Google Email Address, so I assume there's at least some theoretical way of doing it.
If that exact ability isn't possible, is there a relatively simple way for me to edit the cloudprint.py or something to make it append the email to like the job name or something? Thanks.
Well, let's see. The print job from Cloud Print includes the submitter's email as the ownerid. The job is sent to cups.Connector.printFile(), which includes an 'options' dictionary argument. Neither Python or cups are clear on exactly what the options are.
So it may be possible, though I don't know what the Cups options would be. Perhaps @armooo / upstream knows more?
It looks like like setting job-originating-user-name
works. Can you give https://github.com/armooo/cloudprint/commit/108b9f02669e141a499e339ed6bf098c5553dabc a try and see if that works for you?
Thanks for the response. I tried to figure out what you want me to try to test it, and am unsure. I made the changes in the cloudprint.py file, but as for the test_process_jobs.py I have no idea what to do with that or if I'm supposed to do anything different to make it work. I basically just replaced the cloudprint.py. I had to install the configargparse because it was throwing errors.
Am I supposed to be passing an argument to something? like "job-originating-user-name" somewhere?
Some reason I thought I posted this question on the armooo's github, but I guess I accidentally posted here... At least you still found the question.
Thanks
You can ignore the test file for now. Make the one-line cloudprint.py change, print, and see if the right email address is reported in your logging.
Okay, so I figured out that it is half working as I was hoping now. What is happening now is CUPS is showing the email correctly now, but when it sends it on to our main print server it loses that info and uses the local linux user again.
Basically, the process goes like this (At least this is my understanding):
Print from Chrome -> Google Cloud Print -> Cloud Print Connector -> Cups Server -> Main Print Server -> Printer
The CUPS server prints to an IPP printer located on our main print server. When it sends the job there it sends along the local linux username instead of the email address.
I turned on CUPS debugging logs, and see that seems to be also using "requesting-user-name" which it's using the local username for. I tried duplicating the line in the cloudprint.py for "job-originating-user-name" but that doesn't correct the issue.
Sounds like it is purely a CUPS issue at this point. I'll release a version with the change, if it turns out to be part of the solution.