Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Class Multi Instructor not giving students access to courses or exchange. Hosted on TLJH #1936

Open
BradPohl opened this issue Nov 8, 2024 · 2 comments

Comments

@BradPohl
Copy link

BradPohl commented Nov 8, 2024

I have an Ubuntu Server hosting The Littlest Jupyter Hub (tljh) and am trying to set up nbgrader for multiple instructors with different classes.

I have gotten the formgrader working and have been able to do a manual exchange of assignments between students and instructors. I am having issues with getting the internal exchange working between students and instructors, however. When I use the command line as student1:

nbgrader fetch_assignment ps1 --course c1

I am told "You do not have access to this course"

I have tried following the documentation here and have tried referencing the demo github here

When releasing assignments they do go into the exchange and have the proper setup.

I really have no idea what to do further or what I may have messed up along the way.

I have 2 nbgrader_config.py files and 1 jupyterhub_config.py file.
The following are my config files

~/jupyter/jupyter_config.py

c = get_config()

#formgrader
c.JupyterHub.NotebookApp.tornado_settings = {
    'headers': {
        'Content-Security-Policy': "frame-ancestors 'self'"
    }
}


# Our user list
c.Authenticator.allowed_users = [
    'jupyter-bradp',
    'jupyter-dakoop',
    'jupyter-professor1',
    'jupyter-student1',
    'jupyter-student2',
    'jupyter-student3',
]

c.Authenticator.admin_users = {
    'jupyter-bradp',
    'jupyter-dakoop',
    'jupyter-professor1',
}


# instructor1 and instructor2 have access to different shared servers:
c.JupyterHub.load_groups = {
    'instructors' = [
        'jupyter-bradp',
        'jupyter-professor1',
    ],
    'formgrade-c1': [
        'jupyter-bradp',
    ],
    'formgrade-course123':[
        'jupyter-professor1',
    ],
    'nbgrader-c1': [
            'jupyter-bradp',
            'jupyter-student1',
    ],
    'nbgrader-course123': [],
}

for course in ['c1']:
    roles.append(
            'name':f'formgrade-{course}',
            'groups':[f'formgrade-{course}'],
            'scopes':[
                f'access:services!service={course}',
            ]
        )
    #course material access
    roles.append(
        {
            'name':f'nbgrader-{course}',
            'groups':[f'nbgrader-{course}'],
            'scopes':[
                    'list:services',
                    f'read:services!service={course}',
                ],
        }
    )


# Start the notebook server as a service. The port can be whatever you want
# and the group has to match the name of the group defined above.
c.JupyterHub.services = [
    {
        'name': 'c1',
        'url': 'http://127.0.0.1:9999',
        'command': [
            'jupyterhub-singleuser',
            '--group=formgrade-c1',
            '--debug',
        ],
        'user': 'jupyter-bradp',
        'cwd': '/home/jupyter-bradp/c1',
        'api_token': token,  # include api token from admin user
    },
    {
        'name': 'course123',
        'url': 'http://127.0.0.1:9998',
        'command': [
            'jupyterhub-singleuser',
            '--group=formgrade-course123',
            '--debug',
        ],
        'user': 'grader-course123',
        'cwd': '/home/grader-course123',
        'api_token': token  # include api token from admin user
    },
]

~/jupyter/nbgrader_config.py (This is the global nbgrader config file)

from nbgrader.auth import JupyterHubAuthPlugin
c = get_config()
c.Exchange.path_includes_course = True
c.Authenticator.plugin_class = JupyterHubAuthPlugin

~/home/jupyter-bradp/c1/nbgrader_config.py

c = get_config()
c.CourseDirectory.course_id = "c1"
c.IncludeHeaderFooter.header = "source/header.ipynb"
c.Exchange.root = '/tmp/exchange'
c.NbGrader.logfile = "/home/jupyter-bradp/nbgrader.log"
@BradPohl
Copy link
Author

I have found a fix.

The global nbgrader_config.py must be placed in:

~/jupyter/jupyter_server_config.d

@brichet
Copy link
Contributor

brichet commented Nov 18, 2024

@BradPohl from the documentation, the global config file can also be placed in a global location, which makes sense for a server installation:

On the nbgrader side of things, activating the JupyterHubAuthPlugin requires you to add it as an authentication plugin class into the nbgrader_config.py for all accounts. This is easiest to do by putting it in a global location such as /etc/jupyter/nbgrader_config.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants