mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Renamed group config option
This commit is contained in:
@@ -156,7 +156,7 @@ async def test_user_group_adding():
|
||||
system('groupadd somegroup')
|
||||
|
||||
assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'set', 'auth.type', 'dummyauthenticator.DummyAuthenticator')).wait()
|
||||
assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'add-item', 'users.groups.somegroup', username)).wait()
|
||||
assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'add-item', 'users.extra_user_groups.somegroup', username)).wait()
|
||||
assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'reload')).wait()
|
||||
|
||||
try:
|
||||
|
||||
@@ -129,22 +129,22 @@ def test_auth_dummy():
|
||||
assert c.JupyterHub.authenticator_class == 'dummyauthenticator.DummyAuthenticator'
|
||||
assert c.DummyAuthenticator.password == 'test'
|
||||
|
||||
|
||||
from traitlets import Dict
|
||||
def test_user_groups():
|
||||
"""
|
||||
Test setting user groups
|
||||
"""
|
||||
c = apply_mock_config({
|
||||
'users': {
|
||||
'groups': {
|
||||
'extra_user_groups': {
|
||||
"g1": ["u1", "u2"],
|
||||
"g1": ["u3", "u4"]
|
||||
"g2": ["u3", "u4"]
|
||||
},
|
||||
}
|
||||
})
|
||||
assert c.UserCreatingSpawner.user_groups == {
|
||||
"g1": ["u1", "u2"],
|
||||
"g1": ["u3", "u4"]
|
||||
"g2": ["u3", "u4"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ default = {
|
||||
'allowed': [],
|
||||
'banned': [],
|
||||
'admin': [],
|
||||
'groups': {}
|
||||
'extra_user_groups': {}
|
||||
},
|
||||
'limits': {
|
||||
'memory': None,
|
||||
@@ -175,7 +175,7 @@ def update_usergroups(c, config):
|
||||
Set user groups
|
||||
"""
|
||||
users = config['users']
|
||||
c.UserCreatingSpawner.user_groups = users['groups']
|
||||
c.UserCreatingSpawner.user_groups = users['extra_user_groups']
|
||||
|
||||
|
||||
def update_limits(c, config):
|
||||
|
||||
@@ -13,7 +13,7 @@ from tljh.normalize import generate_system_username
|
||||
from tljh.yaml import yaml
|
||||
from jupyterhub_traefik_proxy import TraefikTomlProxy
|
||||
|
||||
from traitlets import Any
|
||||
from traitlets import Dict
|
||||
|
||||
class UserCreatingSpawner(SystemdSpawner):
|
||||
"""
|
||||
@@ -21,7 +21,7 @@ class UserCreatingSpawner(SystemdSpawner):
|
||||
|
||||
FIXME: Remove this somehow?
|
||||
"""
|
||||
user_groups = Any(config=True)
|
||||
user_groups = Dict(config=True)
|
||||
|
||||
def start(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user