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
Show server root directory in move dialog #2234
Conversation
I may be wrong, but I don't think that icon is widely recognised as 'notebook server root directory'. If we can figure out the points above, I think we should do this for 5.0, and keep thinking about it for the future. I get the impression that our system of only allowing access to the starting folder and subfolders is not well understood. Maybe we should abandon it entirely - though I'm reluctant to do that, as even if it's a poor security measure by itself, it may make it harder to exploit flaws in other security measures - or maybe we should think about ways to make it clearer what's going on. |
Nice! A few comments:
|
I don't understand the distinction here. Is it OK for the body tag's data attributes to show that the server is running in |
@takluyver I think the issue is about the API path, not filesystem path. So rather than |
...which is the |
Right, it already puts the API path of the directory in the input box where you can edit it. The issue (#2204) is that it's not very clear that you need a path where |
We shouldn't leak information about the filesystem above the directory
where the notebook server was started. So if the notebook server was
started in /home/myself and the user was currently in
/home/myself/mynotebooks, we would only show /mynotebooks
…On Wed, Mar 1, 2017 at 7:15 AM, Thomas Kluyver ***@***.***> wrote:
Right, it already puts the API path of the directory in the input box
where you can edit it. The issue (#2204
<#2204>) is that it's not very
clear that you need a path where / is the root of the notebook server.
This is my attempt to make that clearer.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2234 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABr0JeTf-9sBSvEW03TdLagAy32jiLiks5rhYuZgaJpZM4MNWV8>
.
--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com
|
Arguably the user is already logged in, so it does not matter much, and mot of the time have access to this info via the kernel. Re-arguably against myself, the kernel may not be on the same machine, and the user might have a phone user home. Maybe is root is home show |
I am fine leaving out the leading slash.
…On Wed, Mar 1, 2017 at 12:13 PM, Steven Silvester ***@***.***> wrote:
On Github, the "root path" is the root of the repo and the path is shown
without a leading slash, why not adopt that for this path as well?
[image: image]
<https://cloud.githubusercontent.com/assets/2096628/23479159/2d73080a-fe89-11e6-9970-d1ff567a47bb.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2234 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABr0NR4sg1Zbdc52pcmOiSoyZ8B8Ptuks5rhdFdgaJpZM4MNWV8>
.
--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com
|
|
We should make sure to do something sensible for the cases where there is no
I like showing the file path in the dialog, and +1 to collapsing $HOME to ~. |
Another (simpler) option to the above is to use |
Good points!
…On Sat, Mar 4, 2017 at 6:10 PM, Min RK ***@***.***> wrote:
We should make sure to do something sensible for the cases where there is
no server_root directory, e.g. when using pgcontents or GDrive. The
prefix should probably come from the ContentsManager, not the Application.
For example:
1. use ContentsManager.root_display (or a better name)
2. base ContentsManager.root_display = '/'
3. FileContentsManager.root_display = self.root_dir by default
4. allow hiding by overriding .root_display in config
I like showing the file path in the dialog, and +1 to collapsing $HOME to
~.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2234 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABr0IVn1ybuxwabloUOtQkBqRuRtAP-ks5rihmjgaJpZM4MNWV8>
.
--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com
|
I'm away this week, and have very limited time to work on anything, so please feel free to move this forwards without me. |
From what I've gathered from this discussion, we have 2 options:
I also updated the styles to use flexbox vs. table like @ellisonbg proposed. |
@minrk Let me know if there's a more elegant way to do this. |
@gnestor we'll need |
Ok, would that just require adding something like this to https://github.com/jupyter/notebook/blob/master/notebook/services/contents/manager.py#L35: root_dir = Unicode(config=True)
@default('root_dir')
def _default_root_dir(self):
return '/' |
@gnestor yes, but it can be simpler. You only need root_dir = Unicode('/', config=True) |
notebook/tree/handlers.py
Outdated
@@ -49,6 +50,7 @@ def get(self, path=''): | |||
notebook_path=path, | |||
breadcrumbs=breadcrumbs, | |||
terminals_available=self.settings['terminals_available'], | |||
server_root=os.path.basename(os.path.normpath(self.settings['server_root_dir'])), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gnestor I think the idea was for it to still be an absolute path, but collapse home to ~
. So instead of basename, call:
root_dir = self.contents_manager.root_dir
home = os.path.expanduser('~')
if root_dir.startswith(home + os.path.sep):
# collapse $HOME to ~
root_dir = '~' + root_dir[len(home):]
This can be done once when defining the server_root_dir
above in notebookapp.py
, rather than here every time. Here, we can use server_root=self.settings['server_root']
, assuming it already has the right form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@minrk Ready for final review |
Thanks! |
Attempt at addressing #2204