Selectively hiding a Kernel

Hello,

I’,m trying to selectively hide a kernel based on a whitelist. So far, I have something like this:

c = get_config()
c.KernelSpecManager.whitelist = {...}
if jupyterhub_user in MATLAB_USERS:
    c.KernelSpecManager.whitelist += "matlab_kernel"

I think what I actually want to do is something with “scopes” in the role dictionary…? I’m not entirely sure though.

How would one best go about configuring this? Effectively I want a kernel to be available to a specific group of users which I can administer separately.

Thanks for any hints!
Paul