mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 22:13:00 +00:00
expose disable_user_config as Spawner.disable_user_config
This commit is contained in:
@@ -140,6 +140,14 @@ class Spawner(LoggingConfigurable):
|
||||
"""
|
||||
)
|
||||
|
||||
disable_user_config = Bool(False, config=True,
|
||||
help="""Disable per-user configuration of single-user servers.
|
||||
|
||||
This prevents any config in users' $HOME directories
|
||||
from having an effect on their server.
|
||||
"""
|
||||
)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Spawner, self).__init__(**kwargs)
|
||||
if self.user.state:
|
||||
@@ -210,6 +218,8 @@ class Spawner(LoggingConfigurable):
|
||||
args.append('--notebook-dir=%s' % self.notebook_dir)
|
||||
if self.debug:
|
||||
args.append('--debug')
|
||||
if self.disable_user_config:
|
||||
args.append('--disable-user-config')
|
||||
args.extend(self.args)
|
||||
return args
|
||||
|
||||
|
@@ -29,7 +29,11 @@ from traitlets import (
|
||||
CUnicode,
|
||||
)
|
||||
|
||||
from notebook.notebookapp import NotebookApp, aliases as notebook_aliases
|
||||
from notebook.notebookapp import (
|
||||
NotebookApp,
|
||||
aliases as notebook_aliases,
|
||||
flags as notebook_flags,
|
||||
)
|
||||
from notebook.auth.login import LoginHandler
|
||||
from notebook.auth.logout import LogoutHandler
|
||||
|
||||
@@ -120,6 +124,14 @@ aliases.update({
|
||||
'hub-api-url': 'SingleUserNotebookApp.hub_api_url',
|
||||
'base-url': 'SingleUserNotebookApp.base_url',
|
||||
})
|
||||
flags = dict(notebook_flags)
|
||||
flags.update({
|
||||
'disable-user-config': ({
|
||||
'SingleUserNotebookApp': {
|
||||
'disable_user_config': True
|
||||
}
|
||||
}, "Disable user-controlled configuration of the notebook server.")
|
||||
})
|
||||
|
||||
page_template = """
|
||||
{% extends "templates/page.html" %}
|
||||
@@ -158,6 +170,7 @@ class SingleUserNotebookApp(NotebookApp):
|
||||
hub_host = Unicode(config=True)
|
||||
hub_api_url = Unicode(config=True)
|
||||
aliases = aliases
|
||||
flags = flags
|
||||
open_browser = False
|
||||
trust_xheaders = True
|
||||
login_handler_class = JupyterHubLoginHandler
|
||||
|
Reference in New Issue
Block a user