Public-Health-Scotland / phsmethods

An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
https://public-health-scotland.github.io/phsmethods/
54 stars 13 forks source link

Function to set project folder permissions #52

Closed Moohan closed 3 years ago

Moohan commented 3 years ago

It would be nice to have a consistent automated way to update project folder permissions so that everyone (in the group) has write access.

I'm not sure if this happens every time but it definitely crops up, a recent example is that I created a new project dir (for an IR) in RStudio and it created it with the permissions: drwxr-sr-x+ I would usually solve this with chmod -R g+w <folder path> in the terminal, but it would be nice to have a function do this automagically.

There's probably some debate to be had about what the 'correct' permissions should be.

Suggestion:

  1. Check if we're in a project with rstudioapi::getActiveProject()
  2. Use the system() command or possibly fs::file_chown(), with fs::dir_ls(rstudioapi::getActiveProject(), recurse = TRUE) to set new permissions, optionally with a user confirmation prompt.
  3. Print a message detailing the new permissions e.g. "now has read-write access and users in have read-write access".
davidc92 commented 3 years ago

I'm going to close this because this is a known IT issue that we are in the process of trying to get fixed. I'm not sure it's the sort of thing that this package is intended for either, unless it is an issue that IT can't fix, although this never used to be a problem so it 100% is fixable!

Moohan commented 3 years ago

Cool, yep should have waited 2 mins for @alicebyers5 to reply as she said the same thing 🙄