New Polished Feature – User Roles

[This article was first published on Posts on Tychobra, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


Polished is an R package that adds authentication and user administration to your Shiny apps. We continue to push forward with new improvements and are happy to introduce a new feature:

user roles


Under the hood, user roles are just strings that you define in your polished.tech dashboard. e.g. you can make a “super_user” role. You can then assign the “super_user” role to 1 or more users of your Shiny app. Then the next time the user signs in to your Shiny app they will have this “super_user” role on their session$userData$user()$roles vector that is made available by polished. You can then check the user’s roles to allow/restrict access to different aspects of your app.

As another example, let’s say you have a table of data stored in your Shiny app. You want to grant some users the ability to add and edit data, while the rest of your users should only be able to view the data. You can use polished’s roles to create an “editor” role, and then assign that role to select users. You can then use the existance of this “editor” role to programmatically allow/restrict adding and editing data.

You may create as many roles as you need. The following is the step my step process for how to create roles in the polished dashboard, and add them to your user:

  1. Go to the “Manage Roles” tab and click the “Add Role” button (top left) to create the “editor” role.

  1. Click the blue button on the same row as your newly created “editor” role to assign users to the role. Here I assigned myself to the role of editor.

  1. From within your Shiny app that is using polished, check your users’ roles to enable/disable certain features of your app.

As noted earlier, you can access your users’ roles in the user object provided by polished at:

session$userData$user()$roles     

Here is a Shiny app using the polshed “editor” role that we created above:

This is a simple feature, but we have found it helps keep our apps consistent and well organized.

If you want to check out roles and other new features today, sign up for an account at polished.tech. And make sure to install the newly released 0.2.0 version of polished from CRAN with:

install.packages("polished")


Please reach out if you have questions or feedback!

To leave a comment for the author, please follow the link and comment on their blog: Posts on Tychobra.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)