After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766563 - Authenticate jobs which needs authentication
Authenticate jobs which needs authentication
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: printers
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Felipe Borges
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2016-05-17 12:46 UTC by Marek Kašík
Modified: 2018-03-01 15:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Notification requesting authentication (1.16 MB, image/jpeg)
2018-02-02 17:43 UTC, Marek Kašík
  Details
Notify user about need for authentication (12.01 KB, patch)
2018-02-21 17:15 UTC, Marek Kašík
committed Details | Review
Screenshot of the notification (529.03 KB, image/jpeg)
2018-02-21 17:16 UTC, Marek Kašík
  Details

Description Marek Kašík 2016-05-17 12:46:25 UTC
When an application which prints something doesn't provide mechanism for entering authentication info the job is held until it is authenticated. This is mainly case for SMB printers (tested on Windows 7 here).

gnome-settings-daemon should check whether reason for current job-state-changed event is job-hold-until-specified and get auth-info-required then (you can have a look at system-config-printer, they have this solved).

Once we get the event it should be processed somehow. There are 2 options:

1) Offer an authentication dialog

2) Open Jobs dialog of gnome-control-center via which it will be possible to authenticate the job
    - maybe we still need this even if we'll decide to got with the first option


Related bug for this is https://bugzilla.gnome.org/show_bug.cgi?id=758170 (this could be used for the gnome-control-center part)
Comment 1 Bastien Nocera 2016-05-17 13:01:23 UTC
Option 2 is much better. We don't really have any UI in gnome-settings-daemon.
Comment 2 Felipe Borges 2016-05-19 11:33:27 UTC
Couldn't we just prompt a gnome-shell modal dialog asking for the authentication? (like we do for wifi passwords, for instance).
Comment 3 Bastien Nocera 2016-05-19 12:40:37 UTC
(In reply to Felipe Borges from comment #2)
> Couldn't we just prompt a gnome-shell modal dialog asking for the
> authentication? (like we do for wifi passwords, for instance).

gnome-shell only pops up password requests from NM and gnome-keyring. Would we be saving the password in gnome-keyring?
Comment 4 Marek Kašík 2016-05-19 12:54:23 UTC
(In reply to Bastien Nocera from comment #3)
> (In reply to Felipe Borges from comment #2)
> > Couldn't we just prompt a gnome-shell modal dialog asking for the
> > authentication? (like we do for wifi passwords, for instance).
> 
> gnome-shell only pops up password requests from NM and gnome-keyring. Would
> we be saving the password in gnome-keyring?

Yes, we could save it in keyring if user wants to. But we also need the password itself so we can authenticate the job.
Comment 5 Bastien Nocera 2016-05-19 12:59:19 UTC
(In reply to Marek Kašík from comment #4)
> (In reply to Bastien Nocera from comment #3)
> > (In reply to Felipe Borges from comment #2)
> > > Couldn't we just prompt a gnome-shell modal dialog asking for the
> > > authentication? (like we do for wifi passwords, for instance).
> > 
> > gnome-shell only pops up password requests from NM and gnome-keyring. Would
> > we be saving the password in gnome-keyring?
> 
> Yes, we could save it in keyring if user wants to. But we also need the
> password itself so we can authenticate the job.

There's 2 problems with using a gnome-shell password prompt:
- you'd need to add code in gnome-shell to handle this specific case
- the modal dialogue should only show up in direct response to a user interaction. Is there going to be a clear connection between a user action and the password prompt showing up in this case?
Comment 6 Felipe Borges 2016-05-19 13:03:25 UTC
(In reply to Bastien Nocera from comment #5)
> (In reply to Marek Kašík from comment #4)
> > (In reply to Bastien Nocera from comment #3)
> > > (In reply to Felipe Borges from comment #2)
> > > > Couldn't we just prompt a gnome-shell modal dialog asking for the
> > > > authentication? (like we do for wifi passwords, for instance).
> > > 
> > > gnome-shell only pops up password requests from NM and gnome-keyring. Would
> > > we be saving the password in gnome-keyring?
> > 
> > Yes, we could save it in keyring if user wants to. But we also need the
> > password itself so we can authenticate the job.
> 
> There's 2 problems with using a gnome-shell password prompt:
> - you'd need to add code in gnome-shell to handle this specific case
> - the modal dialogue should only show up in direct response to a user
> interaction. Is there going to be a clear connection between a user action
> and the password prompt showing up in this case?

I think the case here is very similar to connecting to password-protected network. The user would Print to a printer which requires authentication and would be prompted for the credentials. I think there's a direct correlation.
Comment 7 Marek Kašík 2018-02-02 17:43:44 UTC
Created attachment 367835 [details]
Notification requesting authentication

Here is a proposal of how the notification about a job requesting authentication could look like. It is very similar to other notifications we have there.
It shows up once a job (typically a new one) changes its state to "pending-held" and set "job-state-reasons" attribute to "cups-held-for-authentication" or "job-hold-until" attribute to "auth-info-required".
Clicking it (default action) opens gnome-control's Printers panel with jobs dialog on authentication page (see https://bugzilla.gnome.org/show_bug.cgi?id=758170#c2).
I'll wait for designers opinion on this and will attach here the patch if accepted.
Maybe we could also notify about jobs requiring authentication once gsd starts.
Comment 8 Allan Day 2018-02-20 10:24:21 UTC
(In reply to Marek Kašík from comment #7)
> Created attachment 367835 [details]
> Notification requesting authentication
> 
> Here is a proposal of how the notification about a job requesting
> authentication could look like. It is very similar to other notifications we
> have there.
...

"Printing requires authentication" doesn't seem quite right, grammatically speaking - from a user point of view it's not the process that requires authentication but the printer itself.

"test-printer Requires Authorization" could be a better heading, or "Printer Requires Authorization". The description could then be "Credentials required in order to print" or "Credentials required for "test-print"".
Comment 9 Marek Kašík 2018-02-21 17:15:42 UTC
Created attachment 368725 [details] [review]
Notify user about need for authentication

This patch implements the notification which shows up if a job which needs authentication is created. Clicking the notification (default action) opens gnome-control-center's Printers panel with Jobs dialog which allows user to authenticate the jobs (https://bugzilla.gnome.org/show_bug.cgi?id=758170#c23).
Comment 10 Marek Kašík 2018-02-21 17:16:51 UTC
Created attachment 368726 [details]
Screenshot of the notification
Comment 11 Felipe Borges 2018-02-26 12:58:05 UTC
Review of attachment 368725 [details] [review]:

lgtm.

Sorry for taking so long to review, but the setup for samba to trigger the job-held signals is quite hard. :)

Setting as accepted-commit_after_freeze because I'm unsure whether the release freeze break approved in https://mail.gnome.org/archives/release-team/2018-February/msg00060.html covers this one bug too. Feel free to push if that's the case.

Thanks for your patch!

::: plugins/print-notifications/gsd-print-notifications-manager.c
@@ +432,3 @@
+                notify_notification_close (notification, NULL);
+
+        gboolean  ret;

IMO it would be safer to prefix the commandline with $BINDIR.
Comment 12 Marek Kašík 2018-03-01 15:29:19 UTC
Comment on attachment 368725 [details] [review]
Notify user about need for authentication

(In reply to Felipe Borges from comment #11)
> IMO it would be safer to prefix the commandline with $BINDIR.

Thank you for the review. I've added the BINDIR there and got UI freeze exception approvals from Michael Catanzaro and Olav Vitters and string freeze exception approvals from Piotr Drąg and Alexandre Franke.
I've pushed the patch to master branch.