Today I’m releasing v0.1 of om_skeleton. It begins where uiStub left off, but now includes user authentication – that is, logging in and logging off.
In other words, om_skeleton is R code for Shiny-server-based web sites that allows multiple pages (the code for each of these pages is in a separate file) and multiple users. The users can:
- verify their email address
- log in
- recover lost passwords
- update their email address
- change their password
- view a home page that shows their user record
- view a page that shows all the registered users and a table of all the pages on the site (with administrative privileges).
In the typical Shiny application, all of the code is loaded at one time. “Paging” is handled by tabs and doesn’t involve loading additional information from disk. For large Shiny websites the downsides of this approach are available memory limits, slow startup speed, and naming issues (unintentionally using the same name twice for different things.)
A paged system based on om_skeleton, on the other hand, will need only a fraction of the whole project’s memory space, will load faster, and has fewer namespace problems because only one page is loaded at at time.
You can look at or obtain a copy of om_skeleton on GitHub. The code is extensively commented. You can also play around with it to see what it does at http://dev.open-meta.org/site/om_skeleton/
2 thoughts on “Multi-page, URL-based Shiny web site skeleton with authentication”
attempting to install this gives me
“cannot open compressed file ‘users-table.R’, probable reason ‘Permission denied’
Error in gzfile(file, mode) : cannot open the connection
Calls: runApp … withVisible -> eval -> eval -> save_users -> saveRDS -> gzfile
Checking the code for users-table.R, it doesn’t seem to be produced anywhere.
The file users-table.R — I just realized I should have named that users-table.RDS and have updated the version on GitHub — is referenced in the save-on-disk.R file. The users-table isn’t provided with the skeleton but is created by save-on-disk.R if it doesn’t exist . The line that creates it is the only line in the file that begins “if(file.exists. That line loads the file if it exists or initializes a new version with only the “Admin” user if it doesn’t.
Although the error you’re getting is “cannot open,” it’s happening when the program tries to save the file, which indicates this is a permissions problem – that is, shiny-server doesn’t have permission to write to your app’s folder, which is where users-table.R is stored.
You could either give shiny-server write permission to that folder or move the file to some other folder. To take the second route, change the path in all three places that the users-table.R(DS) filename appears in the save-on-disk.R file.