Tip: favorite paths from regex matching of group names

Our security group structure is a bit more complex than what’s documented at Customization: Add Shortcuts to Files Menu.

Our group names are of the format fsg-hpc-someproject-rw or fsg-hpc-someproject-ro (though >99% of the time, it’s the rw group). These groups have a shared folder /home/projects/someproject.

So, with the help of Rubular and Regular-Expressions.info, our version of apps/dashboard/initializers/ood.rb is:

OodFilesApp.candidate_favorite_paths.tap do |paths|
    projects = User.new.groups.map(&:name).grep(/^fsg-hpc-./)
    projects = projects.map { |p| p = p.scan(/^fsg-hpc-(.+)-r[ow]$/) }.flatten
    paths.concat projects.map { |p| FavoritePath.new("/home/projects/#{p}")  }
1 Like

Hi Mike.

Welcome to the OnDemand Community. Thank you for posting this tip.


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.