File: jupyter_nbclassic_readonly_config.py

package info (click to toggle)
jupyter-server 2.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,068 kB
  • sloc: python: 21,064; makefile: 186; sh: 25; javascript: 14
file content (16 lines) | stat: -rw-r--r-- 434 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Nbclassic read only auth example."""

from jupyter_server.auth import Authorizer


class ReadOnly(Authorizer):
    """Authorizer that makes Jupyter Server a read-only server."""

    def is_authorized(self, handler, user, action, resource):
        """Only allows `read` operations."""
        if action != "read":
            return False
        return True


c.ServerApp.authorizer_class = ReadOnly  # type:ignore[name-defined]