jupyterlab icon indicating copy to clipboard operation
jupyterlab copied to clipboard

Logout button cannot be hidden

Open fcollonval opened this issue 6 years ago • 4 comments

Describe the enhancement

Hey, this is an enhancement.

I was looking at the Logout behaviour in the classical notebook because I was surprised by the PR #6087 not having a way to hide it as for the Shut down button. Actually, it will not appear in the menu if the server option quit_button is True. But this is not coherent with the classical notebook.

In the classical notebook, the Login/Logout buttons display depends on logged_in and login_available properties of AuthenticatedHandler.

https://github.com/jupyter/notebook/blob/9560e0cf4c3a3612f7e0f869035e7e3eeb5853a0/notebook/templates/page.html#L139-L145

https://github.com/jupyter/notebook/blob/9560e0cf4c3a3612f7e0f869035e7e3eeb5853a0/notebook/base/handlers.py#L174-L177

https://github.com/jupyter/notebook/blob/9560e0cf4c3a3612f7e0f869035e7e3eeb5853a0/notebook/base/handlers.py#L184-L194

Those parameters are passed to the jinja template as parameters.

Basically if the user equals "anonymous", those buttons should be hidden. This can be obtain by customizing the login handler class.

Now the question is how to apply a similar behaviour in JupyterLab. I presume the main point is to figure out how to send the information to the frontend through the page_config_data as for the Shut down button.

https://github.com/jupyterlab/jupyterlab/blob/0af6067a79b054a8289dd11649204d03b2bde90a/jupyterlab/labapp.py#L382

fcollonval avatar May 02 '19 07:05 fcollonval

Yep, that sounds right.

blink1073 avatar May 02 '19 08:05 blink1073

Note: this would require changes to jupyterlab_server to add handling of parameters passed as page_config, as well as changes to jupyterlab to separate handling of shutdown from logout using this new page config. https://github.com/jupyterlab/jupyterlab/blob/f0153e0258b32674c9aec106383ddf7b618cebab/packages/mainmenu-extension/src/index.ts#L146

blink1073 avatar May 28 '20 12:05 blink1073

@fcollonval probably this could be closed since the menu items can now be customized via the settings system?

jtpio avatar Aug 17 '22 21:08 jtpio

I would not close it as the logout button should be conditioned on server settings.

fcollonval avatar Aug 18 '22 06:08 fcollonval