Show More
@@ -137,17 +137,25 b' class AuthenticatedHandler(RequestHandler):' | |||||
137 | if not self.application.password and not self.application.read_only: |
|
137 | if not self.application.password and not self.application.read_only: | |
138 | user_id = 'anonymous' |
|
138 | user_id = 'anonymous' | |
139 | return user_id |
|
139 | return user_id | |
140 |
|
140 | |||
141 | @property |
|
141 | @property | |
142 | def read_only(self): |
|
142 | def read_only(self): | |
143 | if self.application.read_only: |
|
143 | """Is the notebook read-only? | |
|
144 | ||||
|
145 | None -- notebook is read-only, but the user can log-in to edit | |||
|
146 | True -- notebook is read-only, no log-in available | |||
|
147 | False -- no read-only mode available, user must log in | |||
|
148 | ||||
|
149 | """ | |||
|
150 | user = self.get_current_user() | |||
|
151 | if user and user != 'anonymous': | |||
|
152 | return False | |||
|
153 | elif self.application.read_only: | |||
144 | if self.application.password: |
|
154 | if self.application.password: | |
145 |
return |
|
155 | return None | |
146 | else: |
|
156 | else: | |
147 | return True |
|
157 | return True | |
148 | else: |
|
158 | ||
149 | return False |
|
|||
150 |
|
||||
151 | @property |
|
159 | @property | |
152 | def ws_url(self): |
|
160 | def ws_url(self): | |
153 | """websocket url matching the current request |
|
161 | """websocket url matching the current request |
@@ -25,7 +25,7 b'' | |||||
25 | <span id="login_widget"> |
|
25 | <span id="login_widget"> | |
26 | {% if current_user and current_user != 'anonymous' %} |
|
26 | {% if current_user and current_user != 'anonymous' %} | |
27 | <button id="logout">Logout</button> |
|
27 | <button id="logout">Logout</button> | |
28 | {% else %} |
|
28 | {% elif read_only is None %} | |
29 | <button id="login">Login</button> |
|
29 | <button id="login">Login</button> | |
30 | {% end %} |
|
30 | {% end %} | |
31 | </span> |
|
31 | </span> |
@@ -54,7 +54,7 b'' | |||||
54 | {% comment when appropriate until notebook.html is templated %} |
|
54 | {% comment when appropriate until notebook.html is templated %} | |
55 | {% if current_user and current_user != 'anonymous' %} |
|
55 | {% if current_user and current_user != 'anonymous' %} | |
56 | <button id="logout">Logout</button> |
|
56 | <button id="logout">Logout</button> | |
57 | {% else %} |
|
57 | {% elif read_only is None %} | |
58 | <button id="login">Login</button> |
|
58 | <button id="login">Login</button> | |
59 | {% end %} |
|
59 | {% end %} | |
60 | </span> |
|
60 | </span> |
@@ -20,10 +20,15 b' data-base-kernel-url={{base_kernel_url}}' | |||||
20 |
|
20 | |||
21 | {% block content_panel %} |
|
21 | {% block content_panel %} | |
22 | <div id="content_toolbar"> |
|
22 | <div id="content_toolbar"> | |
23 |
<span id="drag_info" class="hidden">Drag files onto the list to import |
|
23 | <span id="drag_info" class="hidden">Drag files onto the list to import | |
24 |
<span |
|
24 | notebooks.</span> | |
25 | <button id="new_notebook" class="hidden">New Notebook</button> |
|
25 | ||
26 | </span> |
|
26 | {% if read_only == False %} | |
|
27 | <span id="notebooks_buttons"> | |||
|
28 | <button id="new_notebook" class="hidden">New Notebook</button> | |||
|
29 | </span> | |||
|
30 | {% end %} | |||
|
31 | ||||
27 | </div> |
|
32 | </div> | |
28 | <div id="notebook_list"> |
|
33 | <div id="notebook_list"> | |
29 | <div id="project_name"><h2>{{project}}</h2></div> |
|
34 | <div id="project_name"><h2>{{project}}</h2></div> |
General Comments 0
You need to be logged in to leave comments.
Login now