Restrict file system/tree just to Home Directory before opening Open Workspace Option

Hello team,

I am trying to customize the doOpenWorkspace() function.

The reason is being is that, is to restrict the file system access just to home directory. The users don’t have write permissions outside of home directory in our Theia project. Hence, we don’t want to show/allow users to navigate to other directories outside of home after the user opens the Open Workspace option. Is there a way to get directories which are present under home directory only before the user opens Open Workspace dialog? This will prevent us from users navigating outside of home directory.

From theia code, it doesn’t look like we can customize root folder for workspace and currently, Theia can access the whole os file system. Please check this link.
https://spectrum.chat/theia/general/theia-can-access-the-whole-os-file-system~e15507b0-96bf-4321-baab-bc475886b80d

Is there any way to accomplish this? I would highly appreciate any help on this.

Regards,
Chid.

@chid.crushev thank you for the discussion.

I am trying to customize the doOpenWorkspace() function.

I assume you are trying to modify the OPEN_WORKSPACE (among other functionality):

You can do so by simply unregistering the command (using CommandRegistry.unregisterCommand) and then registering it to your custom implementation.

The problem is I do not believe that is the only place that would need to be modified, and will likely require multiple changes from your part to achieve.

Hey Vince,

Thanks for the reply and highly appreciate it. I am able to write my own doOpenWorkspace() function and rebind it.

However, I need to add an extra logic to it. Currently, when the user opens the Open Workspace dialog, they were able to access the underlying os workspace files and directories as well. So the thing is, I would like to somehow restrict the file tree just to home directory before the user opens the Open Workspace dialog. Do you know any way to accomplish this?

Regards,
Chid.