mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 06:22:59 +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):
|
def __init__(self, **kwargs):
|
||||||
super(Spawner, self).__init__(**kwargs)
|
super(Spawner, self).__init__(**kwargs)
|
||||||
if self.user.state:
|
if self.user.state:
|
||||||
@@ -210,6 +218,8 @@ class Spawner(LoggingConfigurable):
|
|||||||
args.append('--notebook-dir=%s' % self.notebook_dir)
|
args.append('--notebook-dir=%s' % self.notebook_dir)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
args.append('--debug')
|
args.append('--debug')
|
||||||
|
if self.disable_user_config:
|
||||||
|
args.append('--disable-user-config')
|
||||||
args.extend(self.args)
|
args.extend(self.args)
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
@@ -29,7 +29,11 @@ from traitlets import (
|
|||||||
CUnicode,
|
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.login import LoginHandler
|
||||||
from notebook.auth.logout import LogoutHandler
|
from notebook.auth.logout import LogoutHandler
|
||||||
|
|
||||||
@@ -120,6 +124,14 @@ aliases.update({
|
|||||||
'hub-api-url': 'SingleUserNotebookApp.hub_api_url',
|
'hub-api-url': 'SingleUserNotebookApp.hub_api_url',
|
||||||
'base-url': 'SingleUserNotebookApp.base_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 = """
|
page_template = """
|
||||||
{% extends "templates/page.html" %}
|
{% extends "templates/page.html" %}
|
||||||
@@ -158,6 +170,7 @@ class SingleUserNotebookApp(NotebookApp):
|
|||||||
hub_host = Unicode(config=True)
|
hub_host = Unicode(config=True)
|
||||||
hub_api_url = Unicode(config=True)
|
hub_api_url = Unicode(config=True)
|
||||||
aliases = aliases
|
aliases = aliases
|
||||||
|
flags = flags
|
||||||
open_browser = False
|
open_browser = False
|
||||||
trust_xheaders = True
|
trust_xheaders = True
|
||||||
login_handler_class = JupyterHubLoginHandler
|
login_handler_class = JupyterHubLoginHandler
|
||||||
|
Reference in New Issue
Block a user