To share experience, we also encountered the need of specific site libraries accessible only fro some specific groups.
For that we used the R_LIBS_SITE environment variable.
At first, we used to put the logic in the linux initialization session's files, like /etc/profiles.d/r-site-lib.sh. This file is source for every user as part of the initialization of his linux session.
In this file, we put this logic:
- we test if the user belong to a group
- if this group should have access to a specific shared library, we replace or append the path of the library the variable
R_LIBS_SITE
- the shared lib path are access control using the unix groups.
To help with that, we are now using modules (with Lmod) to help manage the groups libraries and R_LIBS_SITE modification. the module load ... calls are also put in the profiles file.
We use this strategy in the company to isolate some packages that should be only accessible to some users on the servers. We also could have chosen another session initialization mechanism supported by RStudio Server Pro (like R version prelaunch script)
Otherwise, users are managing there own libraries themselves and we encourage the use of projects libraries (through renv) to manage specific locked libraries for project, specifically those that aims to be products delivered to other production environments.
Hope this helps !