diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 242d47bec..a34a7474f 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -137,17 +137,25 @@ class AuthenticatedHandler(RequestHandler): if not self.application.password and not self.application.read_only: user_id = 'anonymous' return user_id - + @property def read_only(self): - if self.application.read_only: + """Is the notebook read-only? + + None -- notebook is read-only, but the user can log-in to edit + True -- notebook is read-only, no log-in available + False -- no read-only mode available, user must log in + + """ + user = self.get_current_user() + if user and user != 'anonymous': + return False + elif self.application.read_only: if self.application.password: - return self.get_current_user() is None + return None else: return True - else: - return False - + @property def ws_url(self): """websocket url matching the current request diff --git a/IPython/frontend/html/notebook/templates/layout.html b/IPython/frontend/html/notebook/templates/layout.html index ddc9c444f..93d0602e1 100644 --- a/IPython/frontend/html/notebook/templates/layout.html +++ b/IPython/frontend/html/notebook/templates/layout.html @@ -25,7 +25,7 @@ {% if current_user and current_user != 'anonymous' %} - {% else %} + {% elif read_only is None %} {% end %} diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html index 037d135c9..abcddedf8 100644 --- a/IPython/frontend/html/notebook/templates/notebook.html +++ b/IPython/frontend/html/notebook/templates/notebook.html @@ -54,7 +54,7 @@ {% comment when appropriate until notebook.html is templated %} {% if current_user and current_user != 'anonymous' %} - {% else %} + {% elif read_only is None %} {% end %} diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 631e2bd7d..993ab1481 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -20,10 +20,15 @@ data-base-kernel-url={{base_kernel_url}} {% block content_panel %}
- - - - + + + {% if read_only == False %} + + + + {% end %} +

{{project}}