Tip: Add the allowed directories as shortcuts in the file explorer

If you’re me, then you set a whitelist of directories to be accessible by OOD.

https://osc.github.io/ood-documentation/latest/customization.html#block-or-allow-directory-access

pun_custom_env:
  OOD_ALLOWLIST_PATH: "/work:/home:/project:/scratch:/modules:/nas:/datasets"

But then, you realized that users can no longer navigate to root. Now each of these directories need to be added as shortcuts, to prevent frustration.

https://osc.github.io/ood-documentation/latest/customization.html#add-shortcuts-to-files-menu

But,

you can make this robust. There is no need to hard code the list in two places, because the whitelist environment variable is exposed to the dashboard app ruby initializers.

OodFilesApp.candidate_favorite_paths.tap do |paths|
    allowlist = ENV["OOD_ALLOWLIST_PATH"].split(":")
    paths.concat allowlist.map { |p| FavoritePath.new("#{p}")  }
end

This makes perfect sense. All the directories that they have access to, they have easy access to. And if the list needs to be updated, it only needs to be updated in one place.

1 Like

after the 4.0 update, the link to docs is now here and the code now looks like this:

Rails.application.config.after_initialize do
    OodFilesApp.candidate_favorite_paths.tap do |paths|
    allowlist = ENV["OOD_ALLOWLIST_PATH"].split(":")
    paths.concat allowlist.map { |p| FavoritePath.new("#{p}")  }
    end
end

1 Like

Thanks, yea I noticed this issue too with the path selector. I’m wondering if we should have a special case for the root directory?